#include <iostream>
int main()
{
int matrix[3][3] = {{1, 0, 0},
{0, 1, 0},
{0, 0, 1}};
size_t rows = sizeof matrix/sizeof matrix[0];
size_t cols = (sizeof matrix/sizeof matrix[0][0])/rows;
int identity = 1;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
if (i == j && matrix[i][j] != 1) {
identity = 0;
break;
}
else {
if (i != j && matrix[i][j] != 0) {
identity = 0;
break;
}
}
}
}
if (identity) {
std::cout << "Identity matrix";
}
else {
std::cout << "NOT identity matrix";
}
return 0;
}
/*
run:
Identity matrix
*/