64,639
社区成员
发帖
与我相关
我的任务
分享
#include <iostream.h>
void main()
{
int a[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11}};
int b[4][3],i,j;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
b[j][i] = a[i][j];
}
}
cout<< "按行输出数组A中的数据"<<endl;
for(i=0;i<3;i++){
for(j=0;j<4;j++)
cout<< a[i][j]<<" ";
cout<<endl;
}
cout<< "按行输出数组B中的数据"<<endl;
for(i=0;i<4;i++){
for(f=0;j<3;j++)
cout<< b[i][j]<<" ";
cout<<endl;
}
}