fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. const int n=4;
  7. int A[n][n] = {
  8. {6, 9, 6, 3},
  9. {4, 8, 1, 6},
  10. {2, 6, 6, 4},
  11. {4, 6, 9, 4}
  12. };
  13.  
  14. int m=-1;
  15. for(int i = 0; i < n; i++)
  16. for(int j = 0; j < n; j++)
  17. if(A[i][j]>m) m=A[i][j];
  18.  
  19. int q=-1;
  20. for(int i = 0; i < n; i++)
  21. for(int j = 0; j < n; j++)
  22. if(A[i][j]==m) {q=i, j=n+1;}
  23.  
  24. cout << q << "\n";
  25.  
  26. system("pause");
  27. return 0;
  28. }
Success #stdin #stdout #stderr 0.01s 5620KB
stdin
Standard input is empty
stdout
3
stderr
sh: 1: pause: not found