Vla_DOS

4

Apr 1st, 2023
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX = 10;
  5.  
  6. void symmetry(int a[][MAX], int n) {
  7.     bool isSymmetric = true;
  8.     for(int i=0; i<n; i++) {
  9.         for(int j=0; j<n; j++) {
  10.             if(a[i][j] != a[j][i]) {
  11.                 isSymmetric = false;
  12.                 break;
  13.             }
  14.         }
  15.         if(!isSymmetric) break;
  16.     }
  17.     if(isSymmetric) cout << "YES";
  18.     else cout << "NO";
  19. }
  20.  
  21. int main() {
  22.     int n, a[MAX][MAX];
  23.     for(int i=0; i<MAX; i++) {
  24.         for(int j=0; j<MAX; j++) {
  25.             cin >> a[i][j];
  26.         }
  27.     }
  28.     for(int i=0; i<MAX; i++) {
  29.         for(int j=0; j<MAX; j++) {
  30.             cout << a[i][j] << " ";
  31.         }
  32.         cout << endl;
  33.     }
  34.     cout << endl;
  35.     cin >> n;
  36.  
  37.     for(int i=0; i<n; i++) {
  38.         for(int j=0; j<n; j++) {
  39.             cout << a[i][j] << " ";
  40.         }
  41.         cout << endl;
  42.     }
  43.     symmetry(a, n);
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment