Question: C++! Help creating a user defined function that will exlcude the minimum and maxinum number. I just need the function not the whole program! code:
C++! Help creating a user defined function that will exlcude the minimum and maxinum number. I just need the function not the whole program!
code:
//
// This function finds the minimum and maximum of a series of 5 numbers
// This function should have a void return type.
// You must use some reference parameters for this function.
//
// Write this function **********
//
void max_and_minimum (double ) { // incomplete and probably incorrect code
double num1, num2, num3, num4, num5;
cout
cin >> num1 >> num2 >> num3 >> num4 >> num5;
double minimum;
double max;
minimum = num1;
max = num5;
if ( minimum > num2) {
minimum = num2;
}
if (minimum > num3){
minimum = num3;
}
if (minimum > num4) { // end of incomplete and incorrect code
}
// Find the average of 5 numbers excluding the minimum and maximum
// If there is more than one number with the minimum or maximum value,
// only exclude the number one time. For example, if the numbers are:
// 4.5 6.7 2.3 7.8 2.3, the average is calculated using the numbers:
// 4.5 6.7 2.3.
//
// This function must call the above function that finds the minimum and maximum
// values in a series of 5 numbers.
//
// This function does not use reference parameters
//
// Write this function
// End of your code
////////////////////////////////
output :
O c:\UserslcreillyDocuments\Visual Studio 2008 ProjectsWCSCI1370 Fall2011\ContestantScore Debu This program calculates the contestant' s score based on scores from 5 judges The highest and lowest scores are dropped Score from judge 1: 7.3 Score from judge 2 8.5 Score from judge 3: 9.6 Score from judge 4: 3.5 Score from judge 5 w You entered incorrect input Enter a double between and 10: 1999929 You entered incorrect input Enter a double between 0 and 10: 23455 You entered incorrect input Enter a double between 0 and 10: 5.9 The contestant score is 7.23333 Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
