#include
using namespace std;
bool func(int A[], int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (i != j && A[i * n + j] != 0 || i == j && A[i * n + j] != 1)
{
return 0;
}
}
}
return 1;
}
int main()
{
int M[4][4] =
{
{1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,0,1}
};
if (func(*M, 4))
cout << "M是单位阵" << endl;
else
cout << "M非单位阵" << endl;
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)