Test program

Need to to test the program (stu.txt) with this:
Jon
Doe
123
Salisbury
MD
3.54
Sue
Carr
133
Pittsville
MD
3.67
Ed
Bahr
142
Berlin
MD
2.81
I am completely clueless as to how to go about it. I remember the first time I had an assignment that required me to this I had skipped it then...clearly that wasn't the smartest decision thinking about the fact that I need to know it now that I have to review for the final that's coming in a week or so. I would appreciate some help with this, thank you.

[code]
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
using namespace std;

struct studentType
{
string fname;
string lname;
int studentID;
string city;
string state;
double gpa;
};

int main()
{
// declare variables
studentType student;
cout << fixed << showpoint << setprecision(2);
ifstream inFile;
inFile.open("stu.txt");
inFile >> student.fname;
cout << "***Student List***" << endl;


// read the input file
while (inFile)
{
inFile >> student.lname;
inFile >> student.studentID;
inFile >> student.city;
inFile >> student.state;
inFile >> student.gpa;

// write the data from the file
cout << student.fname << endl;
cout << student.lname << endl;
cout << student.studentID << endl;
cout << student.city << endl;
cout << student.state << endl;
cout << student.gpa << endl;
cout << endl;
inFile.ignore(100, '\n');
inFile >> student.fname;
}
inFile.close();

return 0;


} // End of main function
Topic archived. No new replies allowed.