I'm trying to read data in from a file and storing it in an array of nested structures. There are 4 divers each with their own set of data, but my code is only storing for the first and leaving the others blank. The loop is indeed running 4 times, but not storing. How can i fix this? Help would be much appreciated thanks.
Data sample:
KNIFE JACK
1.3 6.0 5.1 6.3 5.9 6.5
WILLIAMSON FLIP A
1.4 3.5 4.1 4.7 7.2 3.8
int i =0;
while (i < 4 && !inFile.eof())
{
getline(inFile, divers[i].diverName);
inFile >> divers[i].info.difficultyFactor;
for (int j = 0; j < 5; j++)
{
inFile >> divers[i].info.scores[j];
}
i++;
}
Ok great, and you understand how that works and everything right. The only reason I ask is because I figure its homework(Don't worry I don't care) and wanted to help as much as I can