用C语言编写如下两个关于数组的程序。如何解答?
2个回答
展开全部
1)
//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int main(void){
float a[3][4]={{1.1,2.2,3.3,4.4},{5.5,6.6,7.7,8.8},{9.9,10.1,11.11,12.12}};
int i,j;
for(i=0;i<3;i++){
for(j=0;j<4;printf("%10f",a[i][j++]));
printf("\n");
}
return 0;
}
2)
//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int main(void){
float a[2][3][4]={{{0.1,0.2,0.3,0.4},{0.5,0.6,0.7,0.8},{0.9,0.01,0.11,0.12}},
{{1.1,2.2,3.3,4.4},{5.5,6.6,7.7,8.8},{9.9,10.1,11.11,12.12}}};
int i,j,k;
for(i=0;i<2;i++){
for(j=0;j<3;j++){
for(k=0;k<4;printf("%10f",a[i][j][k++]));
printf("\n");
}
printf("\n\n");
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询