For some reason this does not return the average of the three grades please help me figure out why its not returning the correct value.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
//prototypes
int getTestScores();
double calcAverage(int testScores);
int main()
{
double testScores = 0.0;
double average = 0.0;
testScores = getTestScores();
average = (int) calcAverage;
//display
cout << fixed << setprecision(1);
cout << "Average: " << average << endl;
system("pause");
return 0;
}
//fuction defs
int getTestScores()
{
int test1 = 0;
int test2 = 0;
int test3 = 0;
int testScores = 0;
cout << "Test Score 1: ";
cin >> test1;
cout << "Test Score 2: ";
cin >> test2;
cout << "Test Score 3: ";
cin >> test3;
testScores = test1 + test2 + test3;
return testScores;
}
double calcAverage(int testScores)
{
double averageScore;
averageScore = testScores / 3;
return averageScore;
}//end