#include<iostream>
int mian()
{
int a[][],b[][],c[][];
int i,j,k;
cout<<"input the Boolean Product of A:"<<endl;
for(i=;i<;i++)
for(j=;j<;j++)
cin>>a[i][j]; cout<<"input the Boolean Product of A:"<<endl;
for(i=;i<;i++)
for(j=;j<;j++)
cin>>b[i][j];
for(i=;i<;i++)
for(j=;j<;j++)
for(k=;k<;k++)
{
if(a[i][k]*b[k][j]==)
c[i][j]=;
else
c[i][j]=;
}
cout<<"The Boolean Product of A and B is:\n"<<endl;
for(i=;i<;i++)
{
cout<<endl;
for(j=;j<;j++)
cout<<c[i][j];
}
cout<<end;
}
#include<iostream>
using namespace std;
void sMatrix(int **arr,int n);
void rMatrix(int **arr,int n);
void tMatrix(int **arr,int n);
void outPut(int *arr,int n); int main()
{
int n,p;
cout << "Please input n:" << endl;
cin >> n;
int *arr = new int[n];
int **arr1 = new int*[n]; for (int i = ; i < n; i++)
arr1[i] = new int[n]; cout << "Please input numbers:" << endl;
for (int i = ; i < n; i++)
cin >> arr[i]; for (int i = ; i < n; i++)
for (int j = ; j < n; j++)
{
if (arr[i] % arr[j] == )
arr1[i][j] = ;
else
arr1[i][j] = ;
}
cout << "Please input p:1,对称关系的判断;2,自反关系的判断;3,传递关系的判断" << endl;
cin >> p;
switch (p)
{
case :sMatrix(arr1,n); break;
case :rMatrix(arr1,n); break;
case :tMatrix(arr1,n); break;
default:exit(); }
} void sMatrix(int **arr1,int n)
{
int c=,d=;
for (int i = ; i < n; i++)
for (int j = ; j < n; j++)
if (arr1[i][j] == arr1[j][i])
c = ;
else
d = ;
if (c == && d == )
cout << "该矩阵既是对称又是反对称!" << endl;
else
if (c == )
cout << "该矩阵对称!" << endl;
else
if (d == )
cout << "该矩阵反对称!" << endl;
} void rMatrix(int **arr1, int n)
{
int c;
for (int i = ; i < n; i++)
if (arr1[i][i] = )
{
c = ;
break;
}
if (c == )
cout<<"该矩阵是自反的!"<<endl;
else
cout<<"该矩阵是反自反的!"<<endl; } void tMatrix(int **arr1,int n)
{
int c = ;
for (int i = ; i < n; i++)
for (int j = ; j < n; j++)
for (int k = ; k < n; k++)
{
if (arr1[i][j] == arr1[j][k] == arr1[i][j])
{
c = ;
break;
} }
if (c == )
cout << "该矩阵是传递的!" << endl;
else
cout << "该矩阵是非传递的" << endl; }