Hello. I have written my code and I am almost done, but I keep getting LNK2019 errors. I'm not sure what I'm doing wrong. Any suggestions?
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int getStudentCount(void);
double getExamScores (int noStudents);
double getLabScores(int noStudents);
double calculatePointGrades(double, double);
char calculateLetterGrades(double);
void showGradeData(double, double, double, double);
int i, noStudents, sum=0;
double exam[100], labAvg[100], gradePt[100];
double totalLabAvg=0, totalExam=0, classLabAvg, classExamAvg;
char letterGrade[100];
int main()
{
getStudentCount();
getExamScores(noStudents);
getLabScores(noStudents);
calculatePointGrades(exam[i], labAvg[i]);
calculateLetterGrades(gradePt[i]);
showGradeData(exam[i], labAvg[i], letterGrade[i], gradePt[i]);
system("pause");
}
int getStudentCount()
{
cout<< "Please enter the number of students" << endl;
cin>> noStudents;
cout<< endl;
return noStudents;
}
double getExamScores(int noStudents)
{
for (i=0; i<noStudents ; i++)
{
cout<< "Please enter the exam grade."<< endl;
cin>> exam[i];
cout<< endl;
}
return exam[i];
}
double getLabScores (int noStudents)
{
for (i=0; i<noStudents ; i++)
{
cout<< "Please enter the lab grade."<< endl;
cin>> labAvg[i];
cout<< endl;
}
return labAvg[i];
}
double calculatePointGrades(double exam[100], double labAvg[100])
{
for(i=0; i<noStudents; i++)
{
gradePt[i]= 0.70*exam[i] + 0.30*labAvg[i];
}
return gradePt[i];
}
char calculateLetterGrades(double gradePt[100])
{
for (i=0; i<noStudents; i++)// calculate grade pt
{
if (gradePt[i]<= 60)
{
letterGrade[i]= 'F';
}
else if (gradePt[i]<= 70)
{
letterGrade[i]= 'D';
}
else if (gradePt[i]<= 80)
{
letterGrade[i]= 'C';
}
else if (gradePt[i]<= 90)
{
letterGrade[i]= 'B';
}
else if (gradePt[i]<= 100)
{
letterGrade[i]= 'A';
}
else
{
cout<< "fail";
}
}
return letterGrade[i];
}
void showGradeData(double exam[100], double labAvg[100], double gradePt[100], double letterGrade [100])
{
cout<<endl<< endl
<< "---------------------------------------------------"<<endl
<< "-----------------------Grades----------------------"<<endl
<< " "<<endl
<< "Exam Grade | Lab Grade | Grade Point | Letter Grade" <<endl;
for (i=0; i<noStudents; i++) //print avg
{
cout<< setw(5) << exam[i] <<setw(5)<<"|"<<setw(5)
<<labAvg[i] <<setw(5)<<"|"<<setw(5)<< gradePt[i]
<<setw(5)<<"|"<<setw(5)<< letterGrade[i]<<endl<<endl;
cout<< "---------------------------------------------------"<<endl;
totalExam= totalExam+exam[i];
totalLabAvg= totalLabAvg+labAvg[i];
}
classExamAvg= totalExam/noStudents;
classLabAvg= totalLabAvg/noStudents;
cout<<endl<<endl;
cout<< "The total lab average is: " << classLabAvg<< endl;
cout<< "The total exam average is: " << classExamAvg<<endl;
}