求二元一次方程的根的程序
有句语句不懂,望指教!#include <stdio.h>
#include <math.h>
void main()
{
float a,b,c, disc,x1,x2,realpart,imagpart;
printf("输入a,b,c:");
scanf("%f,%f,%f",&a,&b,&c);
if (fabs(a)<=1e-6)//这是什么意思?
printf("非二次方程");
else
{
disc=b*b-4*a*c;
if(fabs(disc)<=1e-6)//这里是不是应该为if(fabs(disc)=1e-6)哟?
printf("有两个相等实数根:\n x1=x2=%8.4f \n",-b/(2*a));
else
if(disc>1e-6)
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("有两个实数根:\nx1=%8.4f\nx2=%8.4f\n",x1,x2);
}
else
{
realpart=-b/(2*a);
imagpart=sqrt(-disc)/(2*a);
printf("有两个复根:\n");
printf("x1=%8.4f+%8.4f\n",realpart,imagpart);
}
}