这是什么问题?VC中的问题?
#include<stdio.h>#include<math.h>
void main()
{
float a,b,c,x1,x2,disc;
printf("please input a,b,c:");
scanf("%d%d%d",&a,&b,&c);
if(fabs(a)<1e-6) //我把这个红色的1e-6唤作为“0”,为什么运行的结果就变了?
printf("The equation is not a quadratic\n");
else
{
disc=b*b-4*a*c;
if(disc<0)
printf("The equation has not real root\n");
else
if(fabs(disc)<0)
printf("The equation has two equal roots:%8.4f\n",-b/(2*a));
else
{x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("The equation has distinct real roots:%8.4f,%8.4f\n",x1,x2);
}
}
}