请大神看一下这个C语言魔方矩阵哪里错了#includevoid main(){int a[18][18]={0},n,i,j,b=0,c,d,f;printf("please intput the size of it1-----17\n");scanf("%d",&n);if(n%2==0)printf("请输入奇数\n");j=n/2;a[0][j]=1;c=n*n;n-=1;i=0;f=0;for(

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 11:46:33

请大神看一下这个C语言魔方矩阵哪里错了#includevoid main(){int a[18][18]={0},n,i,j,b=0,c,d,f;printf("please intput the size of it1-----17\n");scanf("%d",&n);if(n%2==0)printf("请输入奇数\n");j=n/2;a[0][j]=1;c=n*n;n-=1;i=0;f=0;for(
请大神看一下这个C语言魔方矩阵哪里错了
#include
void main()
{
int a[18][18]={0},n,i,j,b=0,c,d,f;
printf("please intput the size of it1-----17\n");
scanf("%d",&n);
if(n%2==0)
printf("请输入奇数\n");
j=n/2;
a[0][j]=1;
c=n*n;
n-=1;
i=0;
f=0;
for(b=0;b0)
{ a[0][0]=f+2;i=0;j=0;}
if(i>0&&j==n&&a[i-1][0]==0)
{ a[i-1][0]=f+2;i-=1;j=0;}
else if (a[i-1][0]>0)
{ a[i-1][0]=f+2;i-=1;j=0;}
if(i==0&&j0)
{ a[1][j+1]=f+2;i=1;j+=1;}
if(i>0&&j0)
{ a[i][j+1]=f+2;i=i;j+=1;}
f++;
}
for(b=0;b

请大神看一下这个C语言魔方矩阵哪里错了#includevoid main(){int a[18][18]={0},n,i,j,b=0,c,d,f;printf("please intput the size of it1-----17\n");scanf("%d",&n);if(n%2==0)printf("请输入奇数\n");j=n/2;a[0][j]=1;c=n*n;n-=1;i=0;f=0;for(
我将你的循环改了一下:
for(b=2;b