### Find Lowest and Deduct

Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. For example: if the user enters the values 65, 43, 78, 67 and 64, the output will be:
After dropping the lowest test score, the test average is 68.50
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889`` ``````#include using namespace std; void getScore(double &grade); void calcAverage(double,double,double,double,double); int findLowest(double,double,double,double,double); int main() { double grade1, grade2, grade3, grade4, grade5; getScore(grade1); getScore(grade2); getScore(grade3); getScore(grade4); getScore(grade5); calcAverage(grade1,grade2,grade3,grade4,grade5); } void getScore(double &grade) { static int count = 0; count++; cout << "Please enter in grade number " << count << ": "; cin >> grade; if ( grade < 0 || grade > 100 ) { do { cout << "Please enter in a valid number 0 through 100: "; cin >> grade; } while (grade < 0 || grade > 100 ); } } void calcAverage(double score1, double score2, double score3, double score4, double score5) { double lowest; double average; lowest = findLowest(score1,score2,score3,score4,score5); average = ((score1 + score2 + score3 + score4 + score5) - lowest) / 04; cout << "After dropping the lowest test score , the test average is " << average << endl; } int findLowest(double grad1, double grad2, double grad3, double grad4, double grad5) { double average, least, lowDrop = 0; average = (grad1 + grad2 + grad3 + grad4 + grad5) / 5; cout << "The average before dropping the lowest grade: " << average << endl; if(grad1 < 100) { least = grad1; lowDrop = grad1; return lowDrop; } else if(grad2 < 100) { least = grad2; lowDrop = grad2; return lowDrop; } else if(grad3 < 100) { least = grad3; lowDrop = grad3; return lowDrop; } else if(grad4 < 100) { least = grad4; lowDrop = grad4; return lowDrop; } else if(grad5 < 100) { least = grad5; lowDrop = grad5; return lowDrop; } } ``````

Mine withdraws the First number entered and If I enter 0 it doesn't even count it then takes it as there is only 3 entered
Perhaps something like:

 ``12345678910111213141516171819202122232425`` ``````#include int main() { constexpr unsigned NoScores {5}; constexpr int minScore {}; constexpr int maxScore {100}; double sum {}; int low {maxScore + 1}; std::cout << "Enter " << NoScores << " scores: "; for (unsigned n {}; n < NoScores; ++n) { int score {}; do std::cin >> score; while ((score < minScore || score > maxScore) && (std::cout << "Please enter a valid number " << minScore << " through " << maxScore<< '\n')); if (score < low) low = score; sum += score; } std::cout << "Average of best " << NoScores - 1 << " scores is " << (sum - low) / (NoScores - 1) << '\n'; }``````

while yours works perfectly , I forgot to add.

It should use the following functions:
• An int function getScore with no parameters, to ask the user for a single test score, validate it and return the score. The function should be called by the main function once for each of the five scores to be entered. Do not accept test scores lower than 0 or higher than 100.
• An int function findLowest that is passed the five test scores and then finds and returns the lowest of the five scores passed to it. It is called by function calcAverage, to determine which of the five scores to drop.
• A float function calcAverage that is passed the five test scores and then calculates and returns the average of the four highest scores.
• A void function displayOutput that is passed the average score; it then displays the average of the test scores. Display two digits after the decimal point.
I have corrected it , it works now!