Question
Two-Dimensional Arrays A two-dimensional array is an array of one-dimensional arrays. For example, int arr_2D21 (5) is an array with 2 elements which are themselves
Two-Dimensional Arrays A two-dimensional array is an array of one-dimensional arrays. For example, int arr_2D21 (5) is an array with 2 elements which are themselves integer arrays of sire 5. It is common to refer to the side of a 2D array using rows and columns. In this example, arr_2D has 2 rows and 5 columns, and each row is an array of integers. Consider the following start to your Lab6c.cpp program that will use 2D arrays to calculate and display each student's average over the four assignments. include Modify the above program to compute each student's average over the four assignments. Some notes to assist you are as follows: You will want to initialize the 2D gradebook array at the same time you declare it, using the grades given in the comments. Be sure to use the appropriate constants in the size of the array. 2D arrays are processed using nested for loops. Your outer loop williterate ROMS times, while your inner loop williterate COLS Since you are calculating the average for each student i.e. each row. you will need to reset the sum back to 0 at the start of each outer loop.
Inside the inner loop, you will simply add the current column grade for the current student row in the 2D array) to sun.
Notice that the one-dimensional array is actually a parallel array for the 2D pradebook. That is, row in the gradebook refer to John's grades, while row 1 refers to Sallie's grades, and so forth. You will use this parallel array at the bottom (but still inside) of the outer loop when you print the average computed by dividing sum by the number of assignments, or COLS. Complete the requested changes, and then save the file as Lab6c. cpp, making 56 Dashboard Calendar To Do Notifications Inbox
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started