fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5.  
  6. {
  7. int i,j,m,n;
  8.  
  9. const int mmax = 100; const int nmax = 100;
  10. float A[mmax][nmax];
  11. float B[mmax];
  12.  
  13. cout << "Prosze podac ilosc wierszy macierzy (m<=" << mmax << "):" << endl;
  14. cin >> m;
  15. cout << "Prosze podac ilosc kolumn macierzy (n<=" << nmax << "):" << endl;
  16. cin >> n;
  17.  
  18. for(i=0;i<m;i++)
  19. for(j=0;j<n;j++)
  20. {
  21. cout << "Prosze podac element [" << i+1 << "][" << j+1 << "]:" << endl;
  22. cin >> A[i][j];
  23. }
  24.  
  25. for(i=0;i<m;i++)
  26. {
  27. B[i] = A[i][0];
  28. for(j=1;j<n;j++)
  29. {
  30. if(A[i][j] > B[i])
  31. {
  32.  
  33. B[i] = A[i][j];
  34. }
  35.  
  36. }
  37.  
  38. }
  39.  
  40. cout << "Najwieksze wartosci z poszczegolnych wierszy macierzy to:" << endl;
  41.  
  42. for(i=0;i<m;i++)
  43. {
  44. cout << B[i] << " ";
  45. }
  46. }
Success #stdin #stdout 0s 3032KB
stdin
3
3
9
8
7
6
5
4
3
2
1
stdout
Prosze podac ilosc wierszy macierzy (m<=100):
Prosze podac ilosc kolumn macierzy (n<=100):
Prosze podac element [1][1]:
Prosze podac element [1][2]:
Prosze podac element [1][3]:
Prosze podac element [2][1]:
Prosze podac element [2][2]:
Prosze podac element [2][3]:
Prosze podac element [3][1]:
Prosze podac element [3][2]:
Prosze podac element [3][3]:
Najwieksze wartosci z poszczegolnych wierszy macierzy to:
9   6   3