struct StudentType
{
string socSec; // in the form 123-45-6789
string lastName;
string firstName;
float grade1;
float grade2;
float grade3;
};
StudentType student;
// open file and check for open file etc.
// read data from file, (declare these variables to hold data)
inFile >> ss >> lastN >> firstN >> grd1 >> grd2 >> grd3;
while(inFile)
{
student.socSec = ss;
student.lastName = lastN;
student.firstName = firstN;
student.grade1 = grd1;
student.grade2 = grd2;
student.grade3 = grd3;
inFile >> ss >> lastN >> firstN >> grd1 >> grd2 >> grd3;
}
[\code]
Besure to check for over flow of the list of students in the while loop
if you are using a static container.
such as an array.