infinite loop in the first function dont know how to fix : <p>Keep getting stuck in an infinite loop dont know where my logic went wrong</p>

<p>used while eof and dont know what else is missing, also break statement didnt do anything but print out my test statement once </p>

<pre><code>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 &lt;&lt; "BEEP" &lt;&lt; endl;

                int id;
                int examScore;
                string name;
                inS &gt;&gt; name &gt;&gt; studArray[numStudents].id &gt;&gt; 
studArray[numStudents].name;

                int examId;

                inE &gt;&gt; id &gt;&gt; examId &gt;&gt; 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 &gt;&gt; id &gt;&gt; assignId &gt;&gt; assignScore;

                int studentIndex = findStudent(id, studArray);
                int assignIndex = findAssignment(assignId, 
studArray[studentIndex].assignArray);
                studArray[studentIndex].assignArray[assignIndex].pointsScored 
= assignScore;


        }
}
</code></pre>

<p>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 </p>
