/** readGradeFile *******************************************************
* Read the data from inf into the parallel arrays given.
* @params inf -- input file to read data from @pre inf is already open
* id[] -- container for student id #s
* asgts[] -- container for assignment grades
* mt[] -- container for mid-term grade
* exam[] -- container for exam scores
*
* @pre each student record is on a separate line of the file and
* fields are separated by one or more spaces. All fields are integers.
* All grades are expressed as percentages (0-100).
* @modifies inf -- read to end of file
* id, asgts, mt, exam -- the read information is filled in
* @returns the number of lines read (max is MAX_STUDENTS)
*/
int readGradeFile(std::ifstream& inf, int id[], int asgt[], int mt[], int exam[]);
int readGradeFile(std::ifstream& inf, int id[], int asgt[], int mt[], int exam[]){
int line = 0;
int id;
int asgt;
int mt;
int exam;
ifstream inFile;
for(int i=1;i<=MAX_STUDENTS;i++){
id[i] = inFile.get(id);
asgt[i] = inFile.get(asgt);
mt[i] = inFile.get(mt);
exam[i] = inFile.get(exam);
}
return line;
}
this is my code.plese help me where should be fixed.
thanks.