#include <iostream>
using namespace std;
void cyclic_roll(int &a, int &b, int &c, int &d)
{
int temp = a;
a = b;
b = c;
c = d;
d = temp;
}
int main() {
const int n = 7 ;
int a[n][n];
for (size_t i = 0 ; i < n ; i++){
for(size_t j = 0 ; j < n ; j++){
a[i][j] = rand () % 10 ;
cout << a[i][j] << " ";
} cout << endl ;
}
for(int i=0; i<n/2; i++)
for(int j=0; j<(n+1)/2; j++)
cyclic_roll(a[i][j], a[n-1-j][i], a[n-1-i][n-1-j], a[j][n-1-i]);
cout << endl << endl ;
for (size_t i = 0 ; i < n ; i++){
for(size_t j = 0 ; j < n ; j++){
cout << a[i][j] << " ";
} cout << endl ;
}
for (size_t i = 0 ; i < n ; i++){
for(size_t j = 0 ; j < n ; j++){
if ( i == j ){
a[i][j] = 0 ;
}
if ( i + j == n-1){
a[i][j] = 0 ;
}
if ( i == (n-1)/2 ){
a[i][j] = 0 ;
}
if ( j == (n-1)/2 ){
a[i][j] = 0 ;
}
}
}
cout << endl << endl ;
for (size_t i = 0 ; i < n ; i++){
for(size_t j = 0 ; j < n ; j++){
cout << a[i][j] << " ";
} cout << endl ;
}
return 0;
}