int getScore();
int findLowest();
float calcAverage();
int getScore()
{
int test1, test2, test3, test4, test5;
cout << "Enter the score of the 1st test: ";
cin >> test1;
cout << "Enter the score of the 2nd test: ";
cin >> test2;
cout << "Enter the score of the 3rd test: ";
cin >> test3;
cout << "Enter the score of the 4th test: ";
cin >> test4;
cout << "Enter the score of the 5th test: ";
cin >> test4;
cout << endl;
return (test1, test2, test3, test4, test5);
}
int findLowest(int LO, int test1, int test2, int test3, int test4, int test5)
{
(LO = test1);
if(test1 < LO)
{
LO = test1;
}
int main()
{
int test1, test2, test3, test4, test5;
float averageScore;
for(int i = 0; i < 5; i++)
{
//Call getScore once for each test score to be input
test1 = getScore();
test2 = getScore();
test3 = getScore();
test4 = getScore();
test5 = getScore();
averageScore = calcAverage();
}
return 0;
}
this is my problem, im struggeling. something is wrong with my calcAverage function and after the 5th time i press in all 5 scores it is suppose to stop but keeps going on. to calculate the average i have to drop the lowest score and then calculate the average of only the four highest scores. can any1 help me with my prob?
I'm not going to bombard you with them in one post, though. Let's go through them one-by-one.
When you're getting the scores, should you be using one function to get all of the scores? Or have a function that gets one score and use it five times? (At the minute, you're sort of doing both, although the first four scores in your function are pointless).
nah i should have a function that reads in 5 scores and calculate the average of them, when the lowest scores has been thrown out, then repeat that whole thing 4 more times.
so basically i read in 5 score, one of them will be lowest, then i only calculate the average of the last remaining scores, so that is four scores.
and the whole process must repeat 5 times
it needs to do the following:
my scores are 55, 67, 43, 78 and 80. so the lowest is 43 right? the average must be calculated of 55, 67, 78 and 80, and display the output