Stuck finding coordinates on a bidimensional array

Hi everyone. Im stuck (again) with this code, i need to determinate the coordinatesof the highest number introduced on the matrix. I can't figure out how to do it... nor the coordinates of the highest either the highest number itself...

My code is this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
int N=0,diag=0,f,c,i,j,matriz[100][100],may=0;

cout << "Matrix size: ";
    cin >> N;

    for (f=0;f<N;f++){
        for(c=0;c<N;c++){
            cout << "Element (" <<f <<","<<c<<"):";
            cin >> matriz[f][c];
        }
    }
    cout <<endl <<"  Matrix:" <<endl;

    for(f=0;f<N;f++){
        cout <<endl;
        for(c=0;c<N;c++){
            cout << "   " << matriz[f][c];
        }
    }
    for(f=0;f<N;f++){
        for(c=0;c<N;c++){
            may=matriz[f][c];
            if(matriz[f][c]>may)
            may=matriz[f][c];
        }
    }
    cout << endl << "Highest is: " << may ;


thanks in advance
Last edited on
Did you really mean this? There's obviously something wrong with it.
1
2
3
4
5
6
7
    for(f=0;f<N;f++){
        for(c=0;c<N;c++){
            may=matriz[f][c];
            if(matriz[f][c]>may)
                may=matriz[f][c];
        }
    }
yep... i just figured out minutes after i posted this... the thing is... is not that obviously since im a complete beginner... anyway... when i realized my mistake i just tought "what a dumbass i am ¬¬!
Topic archived. No new replies allowed.