Homework Help

Hey guys, I need your help. I am working on homework and I am getting the error: undefined reference to 'letterGrades'(double)'. I do not know what it means and cannot find how to fix it.

The error occurs on this line of code:
grades[i] = letterGrades(testAverage[i]);

Here is my full code:



#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

//Define the function prototype
char letterGrades(double score);

//Start the main function

int main()
{

//Declare string object for student names

string studentName[5];

//Declare array variable for scores

double testScores[5][4];

//Declare array for students and their grades

char grades[5];

//Declare variable for avg scores

double testAverage[5];

//Ask user for input of student name and test scores

for(int i=0; i<5; i++)
{
cout << "Please enter " << i+1 << " student " << " name: " << endl;

//Get student name
cin >> studentName[i];

//Get test scores
cout << "Enter the students test scores: " << endl;

for(int j=0; j<4; j++)
{
cin >> testScores [i][j];

//Validate the test score
while(testScores[i][j] > 100 || testScores[i][j] <0)
{
cout << "Test score should be between 0 and 100!" << endl;
cout <<"Please enter test score: " << endl;
cin >> testScores[i][j];

}
}
}
//Get the average score of each student and call the letter grade.

for(int i=0; i<5; i++)
{
testAverage[i] = 0;
for(int j=0; j<4; j++)
testAverage[i] += testScores[i][j];
testAverage[i] /= 4;
grades[i] = letterGrades(testAverage[i]);
}
//Display results

cout << "\nStudent Name \t Average Socre \t Letter Grade" << endl;

for(int i=0; i<5; i++)
{
cout.setf(ios::fixed,ios::floatfield);
cout.precision(2);
cout << studentName[i] << "\t\t" << setprecision(2) << testAverage[i] << "\t\t" << grades[i] << endl;
}
return 0;
}
Last edited on
Nevermind, I figured it out. I forgot to finish the prototype.
Topic archived. No new replies allowed.