getline(inFile, st[i].name)
while (inFile){
inFile >> st[i].id
>> st[i].eng101
>> st[i].hist201;
i++;
getline(inFile, st[i].name);
The above code only reads the first line of my input file, and the rest prints out zeros.
My input file is set up like:
John Wall
345505050
95
66
The output looks like:
Student Name ID Eng101-Grade Hist201
John Wall 345.. 95 66
0 0 0
0 0 0
Any suggestions on why my loop only outputs the first struct correctly from my input file, and the rest are zeros?