小白求大佬检查错误!爸爸!while之后的语句为什么不能被执行?
#include "stdio.h"#include "math.h"
#include "stdlib.h"
#define M 33*pow(10,5)
int f1(double B[])
{int i;
double k=B[0];
for(i=1;i<11;i++){if(k>B[i])k=B[i];}
printf("最小的σj:%14.2f\n",k);
i=0;
while(k!=B[i]){i++;}
printf("最小的σj所在列为%d\n",i+1);
if(k<0)return(i+1);
}
int f2(double B[][12],int m)
{int i;
double C[6],k;
for(i=0;i<6;i++){if(B[i][m-1]!=0){C[i]=B[i][11]/B[i][m-1];}else{C[i]=100*M;}}
for(i=0;i<6;i++)printf("θi的数值%14.4f\n",C[i]);
for(i=0;i<6;i++){if(C[i]<0)C[i]=1000*M;}
k=C[0];
for(i=1;i<6;i++){if(k>C[i]) k=C[i];}
printf("最小θi为%14.4f\n",k);
i=0;
while(k!=C[i]){i++;}
printf("最小θi的所在行为%d\n",i+1);
return(i+1);
}
main()
{int i,j,in,out,G[11]={1,2,3,4,5,6,7,8,9,10,11},N[6]={6,7,8,9,10,11};
double a[11]={0.38,0.41,0.55,0,0,0,0,0,M,M,M},min;
double h[6][12]={{0.0061,0.0194,0.0046,0,0,1,0,0,0,0,0,0.0061},
{0.421,0.3248,0.2137,0,0,0,1,0,0,0,0,0.272},
{0.18,0.162,0.11,0,0,0,0,1,0,0,0,0.14},
{1,1,1,0,0,0,0,0,1,0,0,1},
{13.536,17.793,24.346,-1,0,0,0,0,0,1,0,21.032},
{0.2191,0.385,0.3848,0,-1,0,0,0,0,0,1,0.371}
};
double E[11],g,J[6]={0,0,0,M,M,M};
int k=5;double p,q[12],r[6];
printf("Cj ");
for(i=0;i<11;i++)
printf("%6.2f",a[i]);
printf("\n");
printf(" X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 b\n");
for(i=0;i<6;i++)
for(j=0;j<12;j++)
{printf("%7.4f",h[i][j]);
if((j+1)%12==0)printf("\n");}
printf("\n");
for(i=0;i<6;i++)
printf("%10d",N[i]);
printf("\n");
do{
printf("σj= ");
for(j=0;j<11;j++)
{g=0;
for(i=0;i<6;i++){g=J[i]*h[i][j]+g;}
E[j]=a[j]-g;
printf("%14.2f",E[j]);}
printf("\n");
printf("\n");
in=f1(E);
out=f2(h,in);
J[out-1]=a[in-1];
p=h[out-1][in-1];
for(j=0;j<12;j++) q[j]=h[out-1][j]/p;
for(i=0;i<6;i++)
r[i]=h[i][in-1];
printf("\n");
for(i=0;i<6;i++)
for(j=0;j<12;j++){h[i][j]=h[i][j]-r[i]*q[j];}
for(j=0;j<12;j++)h[out-1][j]=q[j];
for(i=0;i<6;i++)
for(j=0;j<12;j++)
{printf("%12.4f",h[i][j]);
if((j+1)%12==0)printf("\n");}
printf("\n");
printf("基本变量的下标");
N[out-1]=G[in-1];for(i=0;i<6;i++)
printf("%10d",N[i]);
printf("\n");
printf("基本变量的系数");
for(i=0;i<6;i++)printf("%14.2f",J[i]);printf("\n");
printf("\n");
min=0;
for(i=0;i<6;i++)min=J[i]*h[i][11]+min;
printf("min S=%10.4f\n",min);
printf("\n");printf("要按回车键才能继续往下算哦...\n");printf("必须按回车哦......\n");
printf("如果这个exe自动关闭了就说明计算过程已经完成了\n");
printf("这个exe关闭之前得到的值就是最小的min S值\n");
getchar();
}while(in!=0);
system("pause");
}