#include "stdafx.h" using namespace std; int ** create(int, int); //creating of massiv void free(int **, int); //deleting of matrix void initialize(int **, int, int); //input of matrix void print(int**, int, int); //printing of matrix int ** turn(int**, int, int, int); //turn mass int ** turn_left(int**, int, int, int); //turn mass on the left_side int _tmain() { int a=1, b; // answer and number of elements int j = 0; int n; //number of string int m; //number of columns cout << "Enter the number of the strings\n"; cin >> n; cout << "Enter the number of the columns\n"; cin >> m; cout << endl; int **A = create(n, m); //creating of massiv initialize(A, n, m); //initializing of massiv print(A, n, m); //array output on the screen //turn of massiv ^___^ int k = n / 2; //количество слоев k = 1; //DANGER DANGER DANGER while (a == 1) { cout << "\nTurn the array\n1)right\n2)left?\n"; cin >> a; cout << "\nHow many elements to turn an array?\n"; cin >> b; if (a == 1) { while (b > 0) { turn(A, n, m, k); //передаем в функцию параметры-имя массива,размер,количество слоев b--; } cout << endl; print(A, n, m); //array output on the screen } else if (a == 2) { while (b > 0) { turn_left(A, n, m, k); //повторот влево b--; } cout << endl; print(A, n, m); } else { cout << "Error. Wrong answer\n"; } cout << "\nTurn again?\n1)Yes\n2)No\n"; cin >> a; } free(A, n); //deleting of matrix system("pause"); return 0; } int** create(int N, int M) { int** mas = new int*[N]; for (int i = 0; i0) { for (int i = 0; ii; j--) mas[j][M - i - 1] = mas[j - 1][M - i - 1]; //правую на 1 вниз for (j = M - i - 1; j>i + 1; j--) //верх на 1 вправо mas[i][j] = mas[i][j - 1]; mas[i][i + 1] = b; } k--; } return mas; } int** turn_left(int **mas, int N, int M, int k) { int b; int i, j; while (k>0) { for (i = 0; ii; j--) //левую на 1 вниз mas[j][i] = mas[j - 1][i]; for (j = i; ji + 1; j--) //низ на один вправо mas[N - i - 1][j] = mas[N - i - 1][j - 1]; mas[N - i - 1][i + 1] = b; } k--; } return mas; }