/* lab2.cpp * * This is the main program that reads students from the file and * store them in student objects. */ #include "student.h" #include #include using namespace std; // The maximum number of students to read in const int array_size = 10; const int number_length = 7; const int name_length = 21; // read a student from file void readStudent(istream&, Student&); // write a student on screen void writeStudent(Student); // main method int main(void) { Student students[array_size]; // an array of students int i; // counter for "for" loops fstream input; // input stream char inputname[40]; // input filename cout << "What is the input file name? "; cin >> inputname; // open the file for input input.open(inputname, ios::in); // Check to make sure that we could open the files properly! if (input.fail()) { cerr << "Could not open file "; cerr << inputname; cerr << ".\n"; return 1; } // read students for (i=0;i