Keep getting stuck in an infinite loop dont know where my logic went wrong
used while eof and dont know what else is missing, also break statement didnt do anything but print out my test statement once
void readSetupData(string sfile, string efile, string afile, students
studArray[])
{
ifstream inS(sfile.c_str());
ifstream inA(afile.c_str());
ifstream inE(efile.c_str());
int numStudents = 0;
while (!inS.eof())
{
cout << "BEEP" << endl;
int id;
int examScore;
string name;
inS >> name >> studArray[numStudents].id >>
studArray[numStudents].name;
int examId;
inE >> id >> examId >> examScore;
int studentIndex = findStudent(id, studArray);
int examIndex = findExam(examId,
studArray[studentIndex].examArray);
studArray[studentIndex].examArray[examIndex].pointsScored
=
examScore;
int pointsAvail =
studArray[studentIndex].examArray[examIndex].pointsAvail;
studArray[studentIndex].examArray[examIndex].percentage =
(float)examScore / (float)pointsAvail;
}
while (!inA.eof())
{
int id;
int assignId;
int assignScore;
inA >> id >> assignId >> assignScore;
int studentIndex = findStudent(id, studArray);
int assignIndex = findAssignment(assignId,
studArray[studentIndex].assignArray);
studArray[studentIndex].assignArray[assignIndex].pointsScored
= assignScore;
}
}
the first void function is the problem and the test statement BEEP is repeated when compiled and ran with ./a.out student_info.txt exam_info assignment_info.txt exam_scores.txt assignment_scores grades.out