Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. int a[5][4] = {{1,1,1,0},{-2,-3,2,1},{2,-5,0,-1},{-1,4,6,2},{-6,6,3,4}};
  2. int maxIndex = 0;
  3. int maxVal = a[0][0];
  4.  
  5. for (int i=0;i<5;i++){
  6. for (int j=0;j<4;j++){
  7. if (a[i][j] > maxVal){
  8. maxVal = a[i][j];
  9. maxIndex = j;
  10. }
  11. }
  12. }
  13.  
  14. std::cout << "najwieksza wartosc: " << maxVal << " index: " << maxIndex;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement