Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. matrix[0][0]=1;
  2.     matrix[0][1]=2;
  3.     matrix[0][2]=3;
  4.     matrix[1][0]=0;
  5.     matrix[1][1]=0;
  6.     matrix[1][2]=1;
  7.     matrix[2][0]=3;
  8.     matrix[2][1]=4;
  9.     matrix[2][2]=3;
  10.  
  11.     while(indexRows < ROWS)
  12.     {
  13.         for ( indexCols = 0; indexCols < COLS; indexCols++)
  14.             maxrow += matrix[indexRows][indexCols];
  15.         if (maxrow > finalmaxR)
  16.         {
  17.             finalmaxR = maxrow;
  18.             numRow = indexRows;
  19.             indexRows++;
  20.         }
  21.         else
  22.             indexRows++;
  23.         maxrow = 0;
  24.     }
  25.     cout << numRow <<endl;
  26.  
  27.  
  28.  
  29.     while(indexCols < COLS)
  30.     {
  31.         for ( indexRows = 0; indexRows < ROWS; indexRows++)
  32.             maxcol += matrix[indexRows][indexCols];
  33.         if (maxcol > finalmaxC)
  34.         {
  35.             finalmaxC = maxcol;
  36.             numCol = indexCols;
  37.             indexCols++;
  38.         }
  39.         else
  40.             indexCols++;
  41.         maxcol = 0;
  42.     }
  43.     cout << numCol<<endl;
  44.     return 0;
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement