holdscreen ("All the scores have been processed!");
return 0;
}
void getData(ifstream& inFile, studentType sList[], int listSize)
{
for (int i = 0; i < listSize; i++)
inFile >> sList[i].studentFName >> sList[i].studentLName
>> sList[i].testScore;
return;
}
void calculateGrade(studentType sList[], int listSize)
{
for (int i = 0; i < listSize; i++)
{
switch (sList[i].testScore / 10)
{
case 10:
case 9:
sList[i].grade = 'A';
break;
case 8:
sList[i].grade = 'B';
break;
case 7:
sList[i].grade = 'C';
break;
case 6:
sList[i].grade = 'D';
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
sList[i].grade = 'F';
}
}
return;
}
int highestScore(const studentType sList[], int listSize)
{
int hScore = sList[0].testScore;
for (int i = 1; i < listSize; i++)
if (hScore < sList[i].testScore)
hScore = sList[i].testScore;
return hScore;
}
void printResult(ofstream& outFile, const studentType sList[])
{
int listSize;
int maxScore = highestScore(sList, listSize); //bug2 listsize not declared
int i;
outFile << setw(15) << "Student Name " //bug3 iomanip not included
<< setw(10) << "Test Score"
<< setw(7) << "Grade" << endl;
for (i = 0; i < listSize; i++)
outFile << left << setw(25) //bug4 f not capitalized in outFile
<< sList[i].studentLName + ", " + sList[i].studentFName
<< right << " " << setw(5) << sList[i].testScore
<< setw(6) << " " << sList[i].grade << endl;
outFile << endl << "Highest Test Score: " << maxScore << endl;
outFile << "Students having the highest test score:" << endl;
for (i = 0; i < listSize; i++)
if (sList[i].testScore == maxScore)
outFile << sList[i].studentLName + ", " + sList[i].studentFName
<< endl;
return;
}
void holdscreen( string exitMessage )
{
char holdscr = 0;
cout << "\n\n\t * * * " << exitMessage << " * * *"
<< "\n\n\t Enter a character and return to exit the program! ";
cin >> holdscr;
return;
}
The last parameter int listSize is missing from the function header. Put that in so that the prototype and main definition agree and the '[Error] ld returned 1 exit status' should be fixed.