Question: PLEASE I NEED THE ANSWERS ASAP. Debugging: The code below has six errors. The errors may be syntax errors or logic errors, and there may

PLEASE I NEED THE ANSWERS ASAP.

Debugging:

The code below has six errors. The errors may be syntax errors or logic errors, and there may be more than one per line; examine the code carefully to find them. Indicate each of the errors you find by writing the line number and correction in the space provided below.

This program is designed to take a constant number of scores (3 in this case) and store them into an array. Then the array is passed to a function and the average score is returned.

The expected output should be:

-bash-4.1$ ./exam1_debug

Enter score #1:

100

Enter score #2:

91

Enter score #3:

80

The average score was: 90.3333

You must find and correct all six of the errors.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

#include

using namespace std;

const NUM_SCORES = 3;

double average(int scores);

int main () {

int scores[NUM_SCORES];

for(i = 0; i < NUM_SCORES;i++){

cout << "Enter score #" << i+1 << ":" << endl;

cin >> scores[i+1];

}

cout << "The average score was: " << scores << endl;

return 0;

}

double average(int scores[]){

int total = 0;

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

total += scores[i];

}

return (total/NUM_SCORES);

}

Line Number

Correction

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!