fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. int main() {
  7. srand( time( NULL ) );
  8. int tab[7][7], D[7], max;
  9. for (int i=0;i<7;i++)
  10. {
  11. for(int j=0;j<7;j++)
  12. {
  13. tab[i][j]=rand()%50+7;
  14. cout<<tab[i][j]<<" ";
  15. }
  16. cout<<endl;
  17. }
  18. cout<<"tablica max:"<<endl;
  19. for (int j=0;j<7;j++)
  20. {
  21. max=tab[0][j];
  22. for(int i=1;i<7;i++)
  23. {
  24. if(tab[i][j]>max) max=tab[i][j];
  25. }
  26. D[j]=max;
  27. cout<<D[j]<<" ";
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
54 33 36 26 18 36 31 
52 35 36 49 53 44 25 
16 44 14 40 20 15 29 
17 16 37 47 18 30 9 
34 22 11 33 50 41 52 
11 22 28 8 52 10 50 
49 49 20 8 36 30 41 
tablica max:
54 49 37 49 53 44 52