用一维写三维数组算法

int a[3][4][5];
for(int i=0;i<3*4*5;i++)
{
a[i/20][(i/5)%4][i%5]=i;
printf("%-2d,%-2d,%-6d",i/20,(i/5)%4,i%5);
if((i+1)%5==0)
printf("\n");
}

posted on 2021-02-19 21:18  行星夜  阅读(54)  评论(0编辑  收藏  举报

导航