求大神帮我看看这个蛇形填数程序。。。
程序代码:#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int a[10][10]={0};
int t=1, b=0,c=n-1;
while(t<n*n) ← 个人觉得应该是这个循环有问题
{
while(b<=n-2&&!a[b][c])
{a[b][c]=t;++t;b++;}
while(c>=1&&!a[b][c])
{a[b][c]=t;++t;c--;}
while(b>=1&&!a[b][c])
{a[b][c]=t;++t;b--;}
while(c<=n-2&&!a[b][c])
{a[b][c]=t;++t,c++;}
}
int x=0,y;
for(x;x<=n-1;x++)
{
for(y=0;y<=n-1;y++)
{
printf("%4d",a[x][y]);
}
printf("\n");
}
system("pause");
return 0;
}题目要求在N*N的方阵中填数填成蛇形 比如当N=4时 填成 10 11 12 1
9 16 13 2
8 15 14 3
7 6 5 4






