I am writing the following program that calculates the average of a group of test scores where the lowest score in the group is dropped. It has the following functions:
- void getScore()-should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered.
- void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores.
- int findLowest(): should find and return the lowest of the five scores passed to it. It should be called by the calcAverage, who uses the function to determine which of the five scores to drop.
So far, here is my version of the program:
#include <iostream>
#include <conio>
using namespace std;
//Function prototype
void getscore(int, int, int, int, int);
int main()
{
int score1, score2, score3, score4, score5;
cout << "Enter your five test scores: ";
cin >> score1 >> score2 >> score3 >> score4 >> score5;
getscore (score1, score2, score3, score4, score5) <<endl;
getch();
return 0;
}
void getscore(int score1, int score2, int score3, int score4, int score5)
{
cout << "Your five test scores are:\n";
cout << score1 <<endl;
cout << score2 <<endl;
cout << score3 <<endl;
cout << score4 <<endl;
cout << score5 <<endl;
}
But, as far as the void calcAverage() and the int findLowest() functions, I am totally confused. I have read my textbook. My instructor tells me that I can use an if-else statement for this program to find the lowest score; she doesn't want us using MAX or MIN or anything like that; we haven't gotten that far.
I need help!!!:|