0

```
430850 First Name Last Name 8 GHZ 1950 YFD 2400 LUO 1950 GXV 350 KKH 1550 IDU 1000 EWT 350 UJU 1100
47760 First Name Last Name 5 ZCW 1850 KQY 1050 EWM 300 MFG 2050 OLW 1200
```

Here is an example from the input file. The first number is an identification number. After the first and last names an integer is given which represents the number of investments the given person holds. For each investment there is a 3 character code followed by the number of shares held.

The problem I am having is figuring out how to read data in without knowing how many investments a given entry has. When I try to run the program as I have it now it stops after the first entry, which isn't even displaying correctly.

`845528 First Name Last Name 00 0`

Can I get some input as to what I'm doing wrong? Some help getting me on the right track would be great. Thanks.

```
while (Infile >> students[StudentNum].iD)
{
Infile >> students[StudentNum].First >> students[StudentNum].Last;
students[StudentNum].Sort = students[StudentNum].Last + ' ' + students[StudentNum].First;
Infile >> students[StudentNum].Investments;
for (i = 0; i < Investments + 1; i++)
{
Infile >> students[StudentNum].Shares >> students[StudentNum].Stock;
StudentNum++;
}
StudentNum++;
if (StudentNum == SizeFromFile)
{
SizeFromFile = (SizeFromFile *2) + 1;
TmpPtr = new Student[SizeFromFile];
for (i = 0; i < StudentNum; i++)
TmpPtr[i] = students[i];
delete[] students;
students = TmpPtr;
TmpPtr = NULL;
}
}
for (i = 0; i < StudentNum; i++)
{
Outfile << students[i].iD << '\t' << students[i].First << ' '
<< students[i].Last << '\t' << students[i].Stock << ' ' << students[i].Shares;
}
```