while(restart==1)
{key=0;
while(key==0)
{
printf("\nProgram start!\n\n\nEnter the number of x n,take care that 1<=n<=%d:",M);
scanf("%d",&n);
printf("How many equations in the question?Enter it:");
scanf("%d",&m);
min=(m>n?n:m);
/*这里规定系数矩阵为方阵*/
for(i=0;i<m;i++)
{printf("Input %d quotions of x[i] in No.%2d equation:\n",n,i+1);
for(j=0;j<n;j++)
scanf("%f",&a[i][j]);
printf("Input b[%2d]:",i+1);
scanf("%f",&b[i]);
}
printf("Enter complete!\nYour equations' quotion are:\n****************************************************************\n");
for(j=0;j<n;j++)
printf(" x%2d ",j+1);
printf("= b \n");
for(i=0;i<m;i++)
{for(j=0;j<n;j++)
printf("%9.5f ",a[i][j]);
printf(" %9.5f\n",b[i]);
}
printf("****************************************************************\nAre they correct?Yes enter 1;No enter 0 to input again:");
scanf("%d",&key);
restart=0;
}
/*********************************以上是变量输入区***************************************************/
for(i=0;i<n;i++)
{cen=0.0;
for(j=0;j<n;j++)
cen=cen+fabs(a[i][j]);
if(fabs(cen)<0.00001&&fabs(b[i])<0.00001)
{key=0;
break;
}
else if(fabs(cen)<0.00001&&fabs(b[i])>0.00001)
{key=-1;
break;
}
}
if(key==0)
{printf("\nThe equations have infinit answer groups because some of the equations you entered are invalid.\nDo you want to enter the equations again?\nEnter 1 to enter again;enter 0 to exit:");
scanf("%d",&restart);
}
else if(key==-1)
{printf("\nThe equations have no answer group because some of the equations you entered are contradictory.\nDo you want to enter the equations again?\nEnter 1 to enter again;enter 0 to exit:");
scanf("%d",&restart);
}
}
if(key==1)
{