//File: recordsFix2.cpp #include #include using namespace std; int main() { struct student_record //defines a new type { string name; //three data fields int age; double gpa; }student; //NOTE: You need the semicolon here! //student_record student; //defines a variable of student_record type ifstream fin ("students.txt"); ofstream fout ("students2.txt"); //The new part //while (fin.peek() != EOF) //{ while ((fin.peek() != EOF) && (fin.peek() != '\n')) { fin >> student.name >> student.age >> student.gpa; fout << student.name << '\t' << student.age << '\t' << student.gpa << endl; //if (fin.peek() == EOF) George's FIX (2/19/02) //exit(0); fin.ignore(); } //} return 0; }