Question: need help modfying this code and fixing it to match the new directions. Col 1 Col2 Col 3 Row 1 23.1 13.58 14 Row 2

need help modfying this code and fixing it to match the new directions.

need help modfying this code and fixing it to match the new

directions. Col 1 Col2 Col 3 Row 1 23.1 13.58 14 Row

Col 1 Col2 Col 3 Row 1 23.1 13.58 14 Row 2 56.78346.29 45.71 Write a program that accomplishes the following objectives: 1. reads in the number of rows, then the number of columns, 2. using nested FOR loops, reads in the column data for each row, 3. adds up the data for each row and derives an average for each row, 4 also adds up all the data in the table and derives an overall average. Hints 1. Look at slides 3 and 4 of CS1336_Lect5e_nested_loops.pptx and Pr5-14.cpp for samples of nested FOR loops, especially line 38 in slide 4 for a calculation of average per student. That is very much like a row average. 2 Have two running total variables, for example rowsum and totalsum. Initialize totalsum to 0 in the beginning of the program Initialize rowsum to 0 before the inner loop (see line 29 in slide 4). Keep running totals for both of these inside the inner loop (see line 36 in slide 4). Average the rowSum after each iteration of the inner loop (see line 38 in slide 4). Average the totalsum after the outside loop ends When the input is as shown in Figure 1. your program should produce the output as shown in Figure 2. Figure 1: (sample input) 23 23.1 13.58 14 56.783 46.29 45.71 Figure 2 (sample output) Lverage of data in row #1 is 16.89 Average of data in row #2 is 49.59 Average of all data is 33.24 6 #include 7 #include 8 using namespace std; 9 10 int main() 11 { 12 int numStudents, // Number of students 13 numTests; // Number of tests per student 14 double total, // Accumulator for total scores 15 average; // Average test score 16 17 // Set up numeric output formatting. 18 cout fixed > numStudents; 22 23 11 Get the number of test scores per student. 24 cin >> numTests; 25 26 1 Determine each student's average score. 27 for (int student = 1; student > score; 34 total += score; 35 } 36 average = total / numTests; 37 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!