Aleksandr_Grigoryev

симметричная

Feb 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i, j;
  6.     const int n = 5;
  7.     int a[n][n];
  8.     for (i = 0; i < n; i++)
  9.     {
  10.         for (j = 0; j < n; j++)
  11.             cin >> a[i][j];
  12.         cout << endl;
  13.     }
  14.     bool q;
  15.     q = true;
  16.     for (i = 0; i < n && q; i++)
  17.     {
  18.         for (j = i + 1; j < n; j++)
  19.             if (a[i][j] != a[j][i])
  20.                 q = false;
  21.     }
  22.     if (q) cout << "symmetrical";
  23.     bool b = true;
  24.     for (i = 0; i < n && b; i++)
  25.     {
  26.         for (j = 0; j < n; j++)
  27.             if (a[i][j] != 0 && i > j)
  28.                 b = false;
  29.     }
  30.     bool t = true;
  31.  
  32.     for (i = 0; i < n && t; i++)
  33.     {
  34.         for (j = 0; j < n; j++)
  35.             if (a[i][j] != 0 && i < j)
  36.                 t = false;
  37.     }
  38.     if (b) cout << "nijnaya treugolnaya";
  39.     if (t) cout << "verhnya treugolnaya";
  40.     bool c=true;
  41.     for (i = 0; i < n&&c; i++)
  42.     {
  43.         for (j = 0; j < n; j++)
  44.             if (a[i][j] == 0 && (i == j) && (j - i == 1 || i - j == 1))
  45.                 c = false;
  46.     }
  47.     if (c)
  48.         cout << "trehdiagonalnaya";
  49.  
  50.  
  51.     system("pause");
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment