Hi do any expert/programmer know how can I compare the same row with same column to derive the maximum value? For examples, column 1 will be comparing with row 1, column 2 will be comparing with row 2, column 3 with row 3 and so on...
I did some c++ coding but it didn't works.
I guess I do not know yet to use what method for comparing same column and same row together, what code can ensure this?
By the way, my error is I have a 5x5 array, my first to fourth looping manage to get the correct maximum value. How ever, for the last, 5th position which is comparing array[4][0] with [0][4], I got the correct maximum value but did not manage to get the correct position [][] of the maximum value.
Thanks.
|
Mentor
|
![]() |
| 8Mar2012,06:33 | #2 |
|
How exactly didn't it work? Post your code. What input did you give (if relevant); what output did you get, and what output did you expect?
|
|
Go4Expert Member
|
|
| 8Mar2012,07:38 | #3 |
|
Hi for example I wanted it to print the maximum value as well as the the position.
For example, this is my 5x5 matrix. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 To compare 1st row with 1st column and as follow, my result should shown: [4][0] - 21 [4][1] - 22 [4][2] - 23 [4][3] - 24 [3][4] - 24, it should have printed [4][3]. |
|
Mentor
|
![]() |
| 8Mar2012,14:01 | #4 |
|
OK, but post your code as well, because I can't see where you went wrong if I can't see your code.
|
|
Go4Expert Member
|
|
| 8Mar2012,14:13 | #5 |
|
Hi sorry, manage to solve this afternoon, thanks for helping anyway! ^^
|

