为什么不执行getchar?
#include#include
main()
{
int x1,x2,x3,y1,y2,y3;double a,b,c,p,s;int i,j,k,h,m,n;char z;
loop: printf("please input three coordinates:");
scanf("%d,%d %d,%d %d,%d",&x1,&y1,&x2,&y2,&x3,&y3);
i=(x1-x2);j=(x2-x3);k=(x1-x3);h=(y1-y2);m=(y1-y3);n=(y2-y3);
if(x1==x2&&x1==x3&&x2==x3)
printf("error:can't calculate the area\n");
else if(y1==y2&&y1==y3&&y2==y3)
printf("error:can't calculate the area\n");
else if(i/h==j/m&&i/h==k/n&&j/m==k/n)
printf("error:can't calculate the area\n");
else
{
a=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
b=sqrt(pow(x1-x3,2)+pow(y1-y3,2));
c=sqrt(pow(x2-x3,2)+pow(y2-y3,2));
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("%lf,%lf,%lf,%lf\n",a,b,c,p);
printf("%lf\n",s);
}
printf("would you like to continue y/n?");
z=getchar();
while(x=='y')
goto loop;
return 0;
}
程序执行了getchar()上句就直接press any key to continue了。。。