}#include<stdio.h>
#include<math.h>
void main()
{
int a,b,c;
int d;
double x1,x2,p1,p2;
printf("a,b,c:");
scanf("%d%d%d",&a,&b,&c);
if(a==0)//不能构成
{
printf("不存在此一元二次方程!");
return
}
if(a!=0)//能构成
{
d=bb-4ac;
if(d>=0)
{
if(d==0)//方程有两个相等实根
{
x2=x1=-b/(2.0a);
printf("x1=x2=%f",x1);
}
else //方程有两个不等实根
{
x1=(-b+sqrt(d))/(2a);
x2=(-b-sqrt(d))/(2a);
printf(”x1=%f x2=%f", x1,x2);
}
}
else
{
//printf("没有实根!");
p1=-b/(2.0a);
p2=sqrt(-d)/(2a);
printf("x1=%f+%fi x2=%f-%fi",p1,p2);
}
}