This program is to enter the scores, get the grades, and display the result.
However, I get a fatal error LNK1120: 1 unresolved externals
Does anyone know how to solve this problem?
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototype
void letter(double score, double resultNum, char grade); //recieve grade
double calc_average(double sum, double num);
char grade[10];
double score[10];
double resultNum = 0;
int i = 1; // for visual appeal
int total_times =1;
double avg = 0;
double sum = 0;
double high = 0;
double low = 100;
double jjj;
int main()
{
do
{
cout << "Enter result " << i << " (or -1 if no more results) ";
cin >> score[i];
jjj = score[i];
if(score[i]!=-1)
{
sum=sum+jjj; //save inputs before continuing
if (jjj>high)
high = jjj; //check for high grades
if (jjj<low)
low = jjj; //check for low grades
resultNum++; //used to divide average
letter(score[i], resultNum, grade[i]); //recieve grade
i++;
total_times = i;
}
}while (score[i] !=-1);
////////////////////////////////////////////////////////
cout << "\nThe list of the results and grades are: " << endl;
for ( i= 1; i < total_times; i++)
cout << "Result " << i << ": " << score[i] << "\t Grade: " << grade[i] << endl;
//////////////////////////////////////////////////////////
//calc_average function for beautiful clean code
cout << "\nThe Average of the results = " << calc_average(sum,resultNum) << endl;
cout << "The Lowest of the results = " << low << endl;
cout << "The Highest of the results = " << high << endl;
}
double calc_average(double sum, double num)
{
return (sum/num);
}
void letter(double score, double resultNum, int i)
{
if (score<60)
{
cout << "Result " << resultNum << " is a U\n" << endl;
grade[i] = 'U';
}
if (score>=60 && score<70)
{
cout << "Result " << resultNum << " is a C\n" << endl;
grade[i] = 'C';
}
if (score>=70 && score<90)
{
cout << "Result " << resultNum << " is a B\n" << endl;
grade[i] = 'B';
}
if (score>=90)
{
cout << "Result " << resultNum << " is a A\n" << endl;
grade[i] = 'A';
}
}