Daniel_leinaD

3.2

Mar 27th, 2022
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <clocale>
  3. using namespace std;
  4.  
  5. int const N = 5;
  6. int i, j, A[N][N];
  7.  
  8. int f(int x[N][N]) {
  9.     int max = 0;
  10.     int qwe = 0;
  11.     for (i = 0; i < N; i++) {
  12.         if (max != 0) {
  13.             cout << max << '\n';
  14.         }
  15.         max = 0;
  16.         qwe = i;
  17.         for (j = i; j < N; j++) {
  18.             if (abs(A[qwe][j]) > max) {
  19.                 max = abs(A[qwe][j]);
  20.             }
  21.         }
  22.     }
  23.     return 0;
  24. }
  25.  
  26. int main() {
  27.     int max = 0;
  28.     for (i = 0; i < N; i++) {
  29.         cout << '\n';
  30.         for (j = 0; j < N; j++) {
  31.             A[i][j] = rand() % 100 - 50;
  32.             cout << A[i][j] << ' ';
  33.         }
  34.     }
  35.     cout << '\n';
  36.     cout << '\n';
  37.     for (i = 0; i < N; i++) {
  38.         if (f(A) != 0){
  39.             cout << f(A);
  40.         }
  41.     }
  42.     cout << A[N - 1][N - 1];
  43. }
Advertisement
Add Comment
Please, Sign In to add comment