这是标准输出:complex roots:-1.0000+1.0000i -1.0000-1.0000i
我的:complex roots:-1.0000-1.#IND i -1.0000-1.#IND i
#include <stdio.h>
#include <math.h>
int main()
{
int a,b,c,dis;
float p,q,x1,x2;
scanf("%d%d%d",&a,&b,&c);
p = -b/(2.0*a);
q = sqrt(dis/2.0*a);
x1 = p + q; x2 = p - q;
if(a==0)
printf("not a quadratic\n");
else if(dis == 0)
printf("two equal roots:x1=x2=%.4f\n",x1);
else if(dis > 0)
printf("distinct real roots:x1 = %.4f x2 = %.4f\n",x1,x2);
else
printf("complex roots:%.4f%.4f i %.4f%.4f i\n",p,q,p,q);
return 0;
}