It keeps giving me test1 /5 as an average score, i cant figure out what is wrong. Ive tried grouping the () differently, and all kinds of other stuff. I swear it worked a handful of times then just quit. Its now almost 1am and im still up trying to figure this simple code out.
For example: 60, 50, 80, 70, 80 gives me an avg of 12 (test1 /5)
#include <iostream>
#include <string>
using namespace std;
double testAvgCal(double, double, double, double, double, double&);
void printing(double);
int main()
{
double test1 = 0;
double test2 = 0;
double test3 = 0;
double test4 = 0;
double test5 = 0;
double testAvg = 0;
cout << "Enter five test scores separated by commas: " << endl;
cin >> test1 >> test2 >> test3 >> test4 >> test5;
testAvgCal(test1, test2, test3, test4, test5, testAvg);
printing(testAvg);
}
double testAvgCal(double test1, double test2, double test3, double test4, double test5, double& testAvg)
{
testAvg = (test1 + test2 + test3 + test4 + test5)/ 5;
return testAvg;
}
void printing(double testAvg)
{
cout << "The test score average of this student is: " << testAvg << endl;
}