Question: Answer in c++ 30.3 Unit 4 - Exercise 2A (2/25) Write a program that takes the input of a 2D matrix from the user. The

 Answer in c++ 30.3 Unit 4 - Exercise 2A (2/25) Writea program that takes the input of a 2D matrix from the

Answer in c++

30.3 Unit 4 - Exercise 2A (2/25) Write a program that takes the input of a 2D matrix from the user. The matrix has 4 rows and 5 columns. The program will search the maximum values of all entries of the matrix and output this maximum value and its row and column position. You can safely assume that the maximum value is unique (ie., no two maximum values) in the matrix. Ex: if the user enters: 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 the program will output: The maximum value is 20 at row 4 and column 1 The minimum value is 1 at row 1 and column 1 You MUST define the following function to return the maximum value from the input 2D matrix and the row and column positions of the maximum value. int GetMax(int data[1[5], int nrows, int ncols, int &rowpos, int &colpos); // to pass a 2D array to a function you need to at least specify the size of the second dimension/column i.e. data[][5]; nrows and ncols are the numbers of rows and columns of the matrix/2D array, respectively: rowPos and colpos store the row and column indices of the found maximum in the array You MUST define the following function to return the minimum value from the input 2D matrix and the row and column positions of the minimum value badge The maximum value is 20 at row 4 and column 1 The minimum value is 1 at row 1 and column 1 You MUST define the following function to return the maximum value from the input 2D matrix and the row and column positions of the maximum value. int GetMax(int data[][5], int nrows, int ncols, int &rowpos, int &colpos); // to pass a 2D array to a function, you need to at least specify the size of the second dimension/column, i.e., data[][5]; nrows and ncols are the numbers of rows and columns of the matrix/2D array, respectively, rowPos and colpos store the row and column indices of the found maximum in the array You MUST define the following function to return the minimum value from the input 2D matrix and the row and column positions of the minimum value. int GetMin(int data[][5], int nrows, int ncols, int &rowPos, int &colpos); In the main, call the functions to get the matrix from user input and determine the min and max values, and print the correct output You must use the functions in the main for points in this exercise. 1986001577296 gxBoy LAB ACTIVITY 30.3.1. Unit 4 - Exercise 2A (2/25) 0750 main.cpp 1 #include 2 using namespace std; 4 int GetMax(int data[][5], int nrows, int ncols, int Srowpos, int &colpos) {

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!