Aleksandr_Grigoryev

HW 13.12.2017 50c

Dec 13th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void create(int **arr, int n,int m)
  4. {
  5.     for (int i = 0; i < n; i++)
  6.     {
  7.         for (int j = 0; j < m; j++)
  8.         {
  9.  
  10.  
  11.             cout << "ENTER arr["<<i<<"]"<<"["<<j<<"]" <<" ";
  12.             cin >> arr[i][j];
  13.         }
  14.     }
  15. }
  16. void show(int **arr, int n, int m)
  17. {
  18.     for (int i = 0; i < n; i++)
  19.     {
  20.         for (int j = 0; j < m; j++)
  21.         {
  22.             cout << arr[i][j] << '\t';
  23.         }
  24.         cout << '\n';
  25.     }
  26. }
  27.  
  28. int main()
  29. {  
  30.     int  n,m;
  31.     cout << "enter n,m";
  32.     cin >> n>>m;
  33.     if (n == m)
  34.     {
  35.         int **a = new int *[n];
  36.         for (int i = 0; i < n; i++)
  37.             a[i] = new int[n];
  38.         create(a, n, m);
  39.         show(a, n, m);
  40.         int x = 0, y = 0, z = 0;
  41.         for (int i = 0; i < n; i++)
  42.        
  43.             for (int j = 0; j < m; j++)
  44.             {
  45.  
  46.  
  47.                 if (a[i][j] == a[j][i])
  48.                     cout << "YES";
  49.                 else cout << "NO";
  50.  
  51.             }
  52.        
  53.     }
  54.     else
  55.     cout << "CAN'T";
  56.     system("pause");
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment