Question: Write a C++ program that finds and displays the maximum value in a two-dimensional array of integers. The array should be declared as a 4-by-5

Write a C++ program that finds and displays the maximum value in a two-dimensional array of integers. The array should be declared as a 4-by-5 array of integers and initialized with the data 16, 22, 99, 4, 18, -258, 4, 101, 5, 98, 105, 6, 15, 2, 45, 33, 88, 72, 16, and 3. MODIFY THE PROGRAM SO THAT IT ALSO DISPLAYS THE MAXIMUM VALUE'S ROW AND COLUMN SUBSCRIPT NUMBERS!! THE ARRAY SHOULD BE INITIALIZED USING THE NUMBERS IN THE PROBLEM. DISPLAY BOTH THE MAXIMUM NUMBER AND THE ROW AND COLUMN INDEX OF IT'S LOCATION!!

** Here is the textbook solution for this problem. The only thing that I see that they left out was the last part of the problem that I have restated in bold, where you are supposed to show NOT JUST the first row's maximum value, BUT THE MAXIMUM NUMBER, AND ALSO THE ROW AND COLUMN INDEX OF IT'S LOCATION!! :

Write a C++ program that finds and displays the maximum value in

10 #include Kiostream> using namespace std; 11 12 13 int main 14 int i, j, max; 15 16 E int arry[4][5] 16, 22, 99, 4, 18, -258, 4, 101, 5, 98, 105, 6, 15, 2, 17 45 33, 88, 72, 16, 3 arry[0] [e]; 18 maX 19 20 for (i ez i K 4; ++i) 21 22 max 0; for (j 0; j k 5; ++j) 23 24 if (arry [i][j] max) 25 26 max arry[i][jl; 27 28 30 31 cout "The Maximum Value Of This Row Is KK max endl endl 32 33 system ("pause"); 34 35 36 return 0 37

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!