### Arrays-max num location

I finally got this array set up but I need help modifying it to display the location (row & column) that the max number is in. Can anyone assist me with this?

Here is what I have:

 ``12345678910111213141516171819202122232425262728293031`` ``````#include #include #include using namespace std; const int ColMax = 5; double MatrixMax(const double[][ColMax],int,int); int main () { int ColRow[2]; const int RowSize = 4, ColSize = 5 ; double Values[RowSize][ColSize] = {{16,22,99,4,18}, {-258,4,101,5,98}, {105,6,15,2,45}, {33,88,72,16,3}}; double Maximum = MatrixMax(Values,RowSize,ColSize); cout << "Contents of Matrix\n"; for (int Row = 0; Row < RowSize; Row++) { for (int Col = 0; Col < ColSize; Col++) cout << setw(6) << Values[Row][Col]; cout << endl; } cout << "Max Value in Matrix = " << Maximum << endl; return 0;} double MatrixMax(const double A[][ColMax], int R, int C) { double Max = A[0][0]; for (int Row = 0; Row < R; Row++) for (int Col = 0; Col < C; Col++) if (A[Row][Col]>Max) Max = A[Row][Col]; return Max;}``````
Whats wrong? I compiled and ran it and it works fine.
I'm trying to make the program display the row & column that the max number is in using the function.
 ``123456`` ``````double MatrixMax(const double A[][ColMax], int R, int C) { double Max = A[0][0]; for (int Row = 0; Row < R; Row++) for (int Col = 0; Col < C; Col++) if (A[Row][Col]>Max) Max = A[Row][Col]; return Max;}``````
Topic archived. No new replies allowed.