一元二次方程的C++,计算结果不对

#include<stdio.h>
#include<math.h>
int main()
{
	float a,b,c,d,x1,x2;
	printf("请输入三个系数:");
	scanf("%f %f %f",&a,&b,&c);
	d=b*b-(4*a*c);
	if(a=0)
	{ 
	x1=-c/b;
	printf("此方程的根是:%f",x1);
	} 
	else if(d==0)
	{ 
	x1=-b/(2*a);
	x2=x1;
	printf("此方程的根是:x1=x2=%f",x1);
	} 
	else if(d>0)
	{ 
	x1=(-b+sqrt(d))/(2*a);
	x2=(-b-sqrt(d))/(2*a);
	printf("此方程的根是:x1=%fx2=%f",x1,x2);
	} 
	else if(d<0)
	{
	printf("此方程无实数根!");
	}
	getch();
	return 0;
 } 

 

好好检查下你的语句,等于是==不是=