Question: Please help modify this code so that there are no cout/cin statements in the int main () function at the bottom. Thank you! #include #include

Please help modify this code so that there are no cout/cin statements in the int main () function at the bottom. Thank you!

#include #include using namespace std; double getSmallest(const double theScores[], int numScores); void getJudgeData(float* score) {

cin >> *score;

while (*score < 0 || *score>10) { cout << " Rejected, try again... "; cin >> *score; } }

float findLowest(float scores[], int s) { float currLow; currLow = scores[0];

for (int i = 0; i < s; i++) {

if (scores[i] < currLow) currLow = scores[i]; } return(currLow); }

float findHighest(float scores[], int s) { float currHigh;

currHigh = scores[0];

for (int i = 0; i < s; i++) { if (scores[i] > currHigh) currHigh = scores[i]; } return(currHigh); } void calcScore(float scores[], int s) {

int lowFlag = -1, highFlag = -1; float Sum = 0, scoreAvg, currLow, currHigh; currLow = findLowest(scores, s); currHigh = findHighest(scores, s); for (int i = 0; i < s; i++) { if (scores[i] == currLow && lowFlag == -1) { scores[i] = 0; lowFlag = 0; }

if (scores[i] == currHigh && highFlag == -1) { scores[i] = 0; highFlag = 0; } }

for (int i = 0; i < s; i++) { Sum = Sum + scores[i]; }

scoreAvg = Sum / 3;

cout << " Average Score: " << scoreAvg << setprecision(2) << fixed << endl << endl; } double getSmallest(const double theScores[], int numScores); int main() { double getSmallest; float scores[5]; int s = 5; float avgScore; cout << " Enter each Judge's score." << setprecision(2) << fixed << endl << endl << endl; for (int i = 0; i < 5; i++) { cout << " Enter Judge #" << i + 1 << " score: "; getJudgeData(&scores[i]); cout << setprecision(2) << fixed << endl; } calcScore(scores, s); cout << setprecision(2) << fixed << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!