Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Passing Two-Dimensional Arrays to Functions In keeping with the grade theme, lets consider the following program: Suppose we have a class with 3 students and

Passing Two-Dimensional Arrays to Functions In keeping with the grade theme, lets consider the following program:
Suppose we have a class with 3 students and 5 quiz grades. In the above program, we create a two-dimensional array with 3 rows (one for each student) and 6 columns (one for each quiz, plus a final column that can be used to hold the quiz average for each student) You should see that the last column for each student contains garbage.
What we want to do is declare and define a new function called computeAverage that accepts the 2D array, along with the number of students (i.e., ROWS), to compute the average of the five quizzes and store that value in the last column for each student. To accomplish this, you will need to do the following:
Add the void function declaration for the computeAverage function, passing in the 2D array and the size (i.e., number of rows).
In main, add the function call to the computeAverage function, passing the 2D grades array and the ROWS constant for the size.
Add the void function definition for the computeAverage function, passing in the 2D array and the size (i.e., number of rows). Remember that in calculating the average, we only need to add up the first five columns and then store the actual average in the last column in the 2D array.
C++
image text in transcribed
image text in transcribed
3. Passing Two-Dimensional Arrays to Functions In keeping with the "grade" theme, let's consider the following program #include

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

Students also viewed these Databases questions

Question

Write an elaborate note on marketing environment.

Answered: 1 week ago