#include<math.h>
#include<stdio.h>
main()
{
float a,b,c,d,x1,x2,p,q;
scanf("%f,%f,%f",&a,&b,&c);
if(a==0)
printf("Input error!");
else
(
d=b*b-4*a*c;
if(d==0)
pintf("x=%f\n",-b/(2*a));
else if(d>0)
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sprt(d))/(2*a);
printf("x1=%f,x2=%f\n",x1,x2);
}
else
{
p=-b/(2*a);
q=sqrt(-d/(2*a));
printf("x1=%f=%fi\n",p,q);
printf("x2=%f-%fi\n",p,q);
}
}
}
请高手指出,谢谢!