Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- template <typename X>
- void printin( X **a, int n, int m) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- cin >> a[i][j];
- }
- }
- }
- template <typename X>
- void printout( X **a, int n, int m) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- }
- template <typename X>
- void simmetrya(X** a, int n, int m) {
- int c = 0;
- for (int i = 1; i < n; i++) {
- for (int j = 1; j <= i; j++) {
- if (a[i][j] == a[j][i]) {
- c = 1;
- }
- else {
- c = 0;
- break;
- }
- }
- }
- cout << c;
- }
- int main() {
- int n, m;
- cin >> n >> m;
- int** a = new int*[n];
- for (int i = 0; i < n; i++) {
- a[i] = new int[m];
- }
- printin(a, n, m);
- simmetrya(a, n, m);
- cout << endl;
- printout(a, n, m);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement