Question: Use the instructions and steps to answer the question. The code has been written but dont understand why the int grades [MAXNUM]; is highlighted in

Use the instructions and steps to answer the question. The code has been written but dont understand why the "int grades [MAXNUM];" is highlighted in red amd throwing am error.
Use the instructions and steps to answer the question. The code has
been written but dont understand why the "int grades [MAXNUM];" is highlighted

Read using a do-while loop a set of numerical grades from the keyboard into an array int grades [1. The maximum number (MAXNUM) of grades to be entered is 10, and data entry should be terminated when a negative number is encountered. Have your C++ program calculate the percentages of the grades and print out with 1 decimal digits of accuracy. NOTE: Partitioning the problem into functions will lead to bonus credits. SOLUTION: STEP 1: Analyze the Problem - Inputs: user grade data captured in the array gradesl. Outputs: percentage of the values in the array grades (1. STEP 2: Develop a Solution - Initialize MAXNUM to be 10. Declare the array as int grades [MAXNUM); Use a do-while loop to populate the array grades ). Use negative grade value to terminate the loop and save the number of valid grades in the variable int numgrades. Use a for loop to add (int sum) the numerical grades, Use another loop to calculate double percentage = grades[l/sum. Avoid integer division Print the percentage with 2 decimal digits of accuracy (fixed setprecision (1)) Hand Calculation: For int grades Il (10, 20, 35); percentages = 15.4.2.2 5 6 7 3 #include #include using namespace std; void input(int grades[], int MAXNUM) { int i = 0, n; do { cin >> n; grades[i++] = n; } while (n >= 0 && i = 0; i++) S += grades[1]; return s; Pint main() { int MAXNUM = 10; int grades[MAXNUM); input(grades, MAXNUM); for (int i = 0; i = 0; i++) cout = 0; i++) { double percentage = ((float)grades[i] * 100) / s; cout

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!