void calcScore(double score1, double score2,
double score3, double score4,
double score5)
{
// Get the lowest score.
// Get the highest score.
// Calculate the total of all five scores.
// Drop the lowest and highest scores and calculate
// the average of the three remaining scores.
// Display the average score with the lowest
// and highest score dropped.
}
My problem is that I don't know how to get the variable from the first function into another function. Any suggestions? Thank you!
Use your calcScore() function to call other functions, such as findLowest(). You already have the 5 scores in calcScore(), just pass those values to other functions.
By your comments in calcScore(), you could create 5 functions, one to perform the work outlined in each comment. The parameters of the first three functions could be all 5 scores, the parameters of the last two could be the 3 scores without the lowest and highest score.
Functions 4 and 5 could be combined into one function since displaying an average could be part of calculating the average of the 3 scores.
You could also drop function 3 and just do the summing of the 5 scores in your calcScore() function.