fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. const int ROWS = 5;
  7. const int COLS = 5;
  8.  
  9. float array[ROWS][COLS];
  10.  
  11. int count = 0;
  12.  
  13. for (int i = 0; i < ROWS; i++)
  14. {
  15. for (int j = 0; j < COLS; j++)
  16. {
  17. cout << (array[i][j] = rand() % 10) << "\t";
  18. }
  19. cout << endl;
  20. }
  21.  
  22. for (int j = 0; j < COLS; j++)
  23. {
  24. int tempmax = array[0][j];
  25. for (int i = 1; i < ROWS; i++)
  26. if (array[i][j] > tempmax)
  27. tempmax = array[i][j];
  28. cout << tempmax << " \t";
  29. }
  30. }
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
3	6	7	5	3	
5	6	2	9	1	
2	7	0	9	3	
6	0	6	2	6	
1	8	7	9	2	
6 	8 	7 	9 	6