fork download
  1. #include <iostream>
  2.  
  3. static const int ROW = 10;
  4. static const int COL = 10;
  5.  
  6. int main()
  7. {
  8. unsigned int array[ROW][COL];
  9.  
  10. srand(0);
  11. for (unsigned int i = 0; i < ROW; ++i)
  12. {
  13. for (unsigned int j = 0; j < COL; ++j)
  14. {
  15. array[i][j] = rand() % 100;
  16. std::cout << array[i][j] << ", ";
  17. }
  18.  
  19. std::cout << std::endl;
  20. }
  21.  
  22. for (unsigned int i = 0; i < ROW; ++i)
  23. {
  24. unsigned int max = array[i][0];
  25.  
  26. for (unsigned int j = 1; j < COL; ++j)
  27. {
  28. if (max < array[i][j])
  29. {
  30. max = array[i][j];
  31. }
  32. }
  33.  
  34. std::cout << max << std::endl;
  35. }
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
83, 86, 77, 15, 93, 35, 86, 92, 49, 21, 
62, 27, 90, 59, 63, 26, 40, 26, 72, 36, 
11, 68, 67, 29, 82, 30, 62, 23, 67, 35, 
29, 2, 22, 58, 69, 67, 93, 56, 11, 42, 
29, 73, 21, 19, 84, 37, 98, 24, 15, 70, 
13, 26, 91, 80, 56, 73, 62, 70, 96, 81, 
5, 25, 84, 27, 36, 5, 46, 29, 13, 57, 
24, 95, 82, 45, 14, 67, 34, 64, 43, 50, 
87, 8, 76, 78, 88, 84, 3, 51, 54, 99, 
32, 60, 76, 68, 39, 12, 26, 86, 94, 39, 
93
90
82
93
98
96
84
95
99
94