Hi, I have a file in the format of:
First-Name Last-Name StudentNumber
Grade1
Grade2
Grade3
Any student may up to 10 grades, and I want to read the information from the text file into a vector.
My question is, how can I read the file into the vector so that the grades are put into the vector as grades and not the student names or numbers (In other words, so everything is kept in order.)
My problem is that the number of grades a student may have is unknown and inconsistant. Any help would be greatly appreciated!
Thanks!
(what I have at the the moment is this)
if (theFile.is_open())
{ // Yup, it's open
StudentData data;
while(!theFile.eof())
{
theFile >> data.first >> data.last
>> data.number; (What to do about the grades?)
vecStudents.push_back(data);
}
}