Hi everyone I'm having a problem with this program giving me the wrong output. The question is
• void getScore() should ask the user for a test score, store it in a reference parameter variable. This function should be called by the main once for of the six scores to be entered by the user.
• double calcAverage() should calculate and return the average of the five highest scores. This function should be called just once by the main, and should be passed the six scores.
• int findLowest() should find and return the lowest of the six scores passed to it. It must be called by calcAverage function, which uses it to determine which of the six scores to drop.
However the program always gives me the s6 as the lowest. this is what I have so far
double calcAverage(int s1, int s2, int s3, int s4, int s5, int &s6)
{
int sum,lowScore;
double avg = 0;
findLowest(s1, s2, s3, s4, s5, s6);
avg = ((s1 + s2 + s3 + s4 + s5 + s6)-lowScore)/5;
}
return lowest;int findLowest(int s1, int s2, int s3, int s4, int s5, int s6)
{
int lowest = s1;
if ( lowest < s2)
{
lowest = s2;
}
if ( lowest < s3)
{
lowest = s3;
}
if ( lowest < s4)
{
lowest = s4;
}
if ( lowest < s5)
{
lowest = s5;
}
if ( lowest < s6)
{
lowest = s6;
}
return lowest;