void C(float a, float b, float c)
{
float xa1,xb1 // x1 = xa1 + i*xb1
float xa2,xb2 // x2 = xa2 + i*xb2
float delta
delta = abs(b*b-4*a*c) //绝对值
xa1 = xa2 = (-b)/(2*a)
xb1 = sqrt(delta)/(2*a)
xb2 = -sqrt(delta)/(2*a)
printf("x1 = %f + %fi\n",xa1,xb1)
printf("x2 = %f + %fi\n",xa2,xb2)
}
else{
if(d==0) /*原程序中的if(d=0) 改为if(d==0)*/
printf("x=%.6lf",e)
else
{ d=-d
f=(sqrt(d))/(2*a)
printf("x1=%.6f+%.6fi",e,f)
printf("x2=%.6f-%.6fi",e,f)
}
}