程式碼示例:
#include <stdio.h>
void boolMatrix(int A[3][2],int B[3][2])
{int i,j,RAnd[3][2],ROr[3][2];
for(i=0;i<3;++i)
{
for(j=0;j<2;++j)
RAnd[i][j]=A[i][j]&B[i][j];
ROr[i][j]=A[i][j]|B[i][j];
}
printf("%d\t%d\t",RAnd[i][j],ROr[i][j]);
printf("\n");
int main(){
//int a[3][2],b[3][2];
int a[3][2] = {{1,0},{1,1},{0,0}};
int b[3][2] = {{1,1},{0,1},{1,1}};
// int rAnd[3][2];
// int rOr[3][2];
//void boolMatrix(int A[3][2],int B[3][2],int RAnd[3][2],int ROr[3][2]);
boolMatrix(a,b);
return 0;
程式碼示例:
#include <stdio.h>
void boolMatrix(int A[3][2],int B[3][2])
{int i,j,RAnd[3][2],ROr[3][2];
for(i=0;i<3;++i)
{
for(j=0;j<2;++j)
{
RAnd[i][j]=A[i][j]&B[i][j];
ROr[i][j]=A[i][j]|B[i][j];
}
}
for(i=0;i<3;++i)
{
for(j=0;j<2;++j)
{
printf("%d\t%d\t",RAnd[i][j],ROr[i][j]);
}
printf("\n");
}
}
int main(){
//int a[3][2],b[3][2];
int a[3][2] = {{1,0},{1,1},{0,0}};
int b[3][2] = {{1,1},{0,1},{1,1}};
// int rAnd[3][2];
// int rOr[3][2];
//void boolMatrix(int A[3][2],int B[3][2],int RAnd[3][2],int ROr[3][2]);
boolMatrix(a,b);
return 0;
}