Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void create(int **arr, int n,int m)
- {
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cout << "ENTER arr["<<i<<"]"<<"["<<j<<"]" <<" ";
- cin >> arr[i][j];
- }
- }
- }
- void show(int **arr, int n, int m)
- {
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cout << arr[i][j] << '\t';
- }
- cout << '\n';
- }
- }
- int main()
- {
- int n,m;
- cout << "enter n,m";
- cin >> n>>m;
- if (n == m)
- {
- int **a = new int *[n];
- for (int i = 0; i < n; i++)
- a[i] = new int[n];
- create(a, n, m);
- show(a, n, m);
- int x = 0, y = 0, z = 0;
- for (int i = 0; i < n; i++)
- for (int j = 0; j <m; j++)
- {
- if (a[i][j] == 0)
- y++;
- if (a[n - i - 1][n - j - 1] == 0)
- z++;
- x++;
- }
- if ((y == x) || (z == x))
- cout << "YES";
- else cout<<"NO";
- }
- else
- cout << "CAN'T";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment