(说明)
实现矩阵(3行3列)的转置(即行列互换)。
例如,输入下面的矩阵:
100 200 300
400 500 600
700 800 900
程序输出:
100 400 700
200 500 800
300 600 900
(函数)
int fun(int array[3][3])
{
int i,j,t;
for(i=0;(1);i++)
for(j=0;(2);j++)
{
t=array[i][j];(3);(4);
}
}
}
main()
{
int i,j;
int array[3][3]={{100,200,300},{400,500,600},{700,800,900}};
clrscr();
for (i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%7d",array[i][j]);
printf("/n");
}
fun((5));
printf("Converted array:/n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%7d",array[i][j]);
printf("/n");
}
}