程序哪里不对? 财富值62

2016-10-07 20:51发布

#include "stdio.h"

#include "math.h"

void root(double a,double b,double c)

{

double d=b*b-4*a*c;

if (a=0)

{printf("这不是一元二次方程! ");}

   else {if (d>0)

{printf("X1=%.2lf ", (-b+sqrt(d))/(2*a));

printf("X2=%.2lf ", (-b-sqrt(d))/(2*a));}

      else {if (d=0)

           printf("X=%.2f ",-b/(2*a));

               else

               printf("实部为%lf ",-b/2*a);

               printf("虚部为%lf ",+(sqrt(-d))/(2*a));

               printf("虚部为%lf ",-(sqrt(-d))/(2*a));}}


}

int main(int argc, char* argv[])

{

   double o,p,q;

scanf("%lf%lf%lf",&o,&p,&q);

root(o,p,q);

return 0;

}