Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Define capital structure.

Answered: 1 week ago

Question

List out some inventory management techniques.

Answered: 1 week ago

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago