Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a[5][4] = {{1,1,1,0},{-2,-3,2,1},{2,-5,0,-1},{-1,4,6,2},{-6,6,3,4}};
- int maxIndex = 0;
- int maxVal = a[0][0];
- for (int i=0;i<5;i++){
- for (int j=0;j<4;j++){
- if (a[i][j] > maxVal){
- maxVal = a[i][j];
- maxIndex = j;
- }
- }
- }
- std::cout << "najwieksza wartosc: " << maxVal << " index: " << maxIndex;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement