Can someone tell me why I am getting an unexpected end of file error?
[code]
//This program collects 5 exam score for individual class members and averages the score.
//The program throws out the low score and replaces it with the high score.
//It uses a sentinel to end the input data.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int array[5];
int y;
int highScore=-999;
int lowScore=101;
int totScore=0.0;
float avg=0.0;
char grade;
string firstName;
string lastName;
string sentinelA="light";
string sentinelB="truth";
cout << "Enter student's first and last name:" << endl;
cin >> firstName >> lastName;
cout << "To stop input data, enter light for student's first name,";
cout << "and truth for student's last name." << endl;
while (firstName != sentinelA && lastName != sentinelB) //Creates input data stopping point.
{
cout << "Enter 5 exam scores for" << firstName << lastName << ":" << endl; //input exam scores
for (y=0; y<5; y++)
{
cin >> array[y];
}
for (y=0; y<5; y++);
{
if(array[y] > highScore)
highScore = array[y];
if(array[y] < lowScore)
lowScore = array[y];
}
for (y=0; y<5; y++) //Throws out the low score and replaces it with the high score.
{
if(array[y] == lowScore)
array[y] = highScore;
}
for(y=0; y<5; y++)
{
totScore = totScore + array[y];
}
{
avg = totScore/5; //Determines average grade.
if(avg > 92.0) //Determines letter grade.
grade='A';
else if (avg > 83.0)
grade='B';
else if(avg > 74.0)
grade='C';
else if(avg >65.0)
grade='D';
else
grade='F';
}
cout << "The 5 exam scores for" << firstName << " " << lastName << ":" << endl;
cout << endl;
for (y=0; y<5; y++)
cout << array[y] << " ";
cout << "The average score for" << firstName << " " << lastName << endl;
cout << "is" <<avg << "%" << "Letter grade is" << grade <<endl << endl;
cout << "Enter the next student's name and exam scores" << endl;
cin >> firstName >> lastName;
{
avg = 0.0;
totScore = 0.0;
}
return 0;
}