Question: Write a C++ program that creates a two-dimensional array (2D array)initialized with test data. The program should have the following functions: getTotal. This function should

Write a C++ program that creates a two-dimensional array (2D array)initialized with test data. The program should have the following functions:

getTotal. This function should accept a two-dimensional array as its argument and return the total of all the values in the array.

getAverage. This function should accept a two-dimensional array as its argument and return the average of all the values in the array.

getRowTotal. This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row.

getColumnTotal. This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column.

getLowestInRow. This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the lowest value in the specified row of the array. Demonstrate each of the functions in this program.

getHighestInRow. This function should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the highest value in the specified row of the array.

Thank you.

Write a C++ program that creates a two-dimensional array (2D array)initialized with

*******STARTER CODE***********

#include  using namespace std; const int COLS = 5; int getTotal(int [][COLS], int); double getAverage(int [][COLS], int); int getRowTotal(int [][COLS], int); int getColumnTotal(int [][COLS], int, int); int getHighestInRow(int [][COLS], int); int getLowestInRow(int [][COLS], int); int main() { const int ROWS = 4; int testArray[ROWS][COLS] = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 }, { 16, 17, 18, 19, 20 } }; cout   #include  using namespace std; const int COLS = 5; int getTotal(int [][COLS], int); double getAverage(int [][COLS], int); int getRowTotal (int [][COLS], int); int getColumnTotalint [][COLS], int, int); int getHighest Inkow(int [][COLS], int); int getLowest InRow(int [][COLS], int); int main() { const int ROWS = 4; int testArray[ROWS][COLS] - { { 1, 6, { 11, { 16, 2, 3: 4,5) 5}, 7, 8, 9, 10 }, 12, 13, 14, 15) 17, 18, 19, 20 } }; 10 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!