#include <iostream>
#include <iomanip>

using namespace std;

enum Symmetry
{
    MDiag = 0x01,
    SDiag = 0x02,
    Horz  = 0x04,
    Vert  = 0x08,
    Centr = 0x10
};

int SymMatrix(int**R, int N)
{
    int sym = 0x1F;
    for(int r = 0; r < N; ++r)
    {
        for(int c = 0; c < N; ++c)
        {
            if ((sym & MDiag) && (R[r][c] != R[c][r]))         sym &= ~MDiag;
            if ((sym & SDiag) && (R[r][c] != R[N-1-c][N-1-r])) sym &= ~SDiag;
            if ((sym & Horz ) && (R[r][c] != R[r][N-1-c]))     sym &= ~Horz;
            if ((sym & Vert ) && (R[r][c] != R[N-1-r][c]))     sym &= ~Vert;
            if ((sym & Centr) && (R[r][c] != R[N-1-r][N-1-c])) sym &= ~Centr;
        }
    }
    return sym;
}

void tell(int sym)
{
    if (sym == 0) cout << "Матрица несимметрична\n";
    else
    {
        cout << "Матрица симметрична:\n";
        if (sym & MDiag) cout << "    относительно главной диагонали\n";
        if (sym & SDiag) cout << "    относительно побочной диагонали\n";
        if (sym & Horz)  cout << "    относительно горизонтали\n";
        if (sym & Vert)  cout << "    относительно вертикали\n";
        if (sym & Centr) cout << "    центральносимметрична\n";
    }
}

int main(int argc, char * argv[])
{
    int ** R = new int*[3];
    for(int i = 0; i < 3; ++i) R[i] = new int[3];

    R[0][0] = 1;  R[0][1] = 2;  R[0][2] = 3;
    R[1][0] = 1;  R[1][1] = 1;  R[1][2] = 1;
    R[2][0] = 3;  R[2][1] = 2;  R[2][2] = 1;

    tell(SymMatrix(R,3));

    R[0][0] = 1;  R[0][1] = 1;  R[0][2] = 1;
    R[1][0] = 1;  R[1][1] = 1;  R[1][2] = 1;
    R[2][0] = 1;  R[2][1] = 1;  R[2][2] = 1;

    tell(SymMatrix(R,3));

    R[0][0] = 1;  R[0][1] = 3;  R[0][2] = 1;
    R[1][0] = 1;  R[1][1] = 7;  R[1][2] = 1;
    R[2][0] = 1;  R[2][1] = 4;  R[2][2] = 1;

    tell(SymMatrix(R,3));
}
