运行后显示错误,error C2065: 'sqrt' : undeclared identifier
# include <stdio.h>
int main(void)
{
double a,b,c;
double delta;
double x1,x2;
printf("请输入一元二次方程的三个系数:");
printf("a=");
scanf("%lf",&a);
printf("b=");
scanf("%lf",&b);
printf("c=");
scanf("%lf",&c);
delta=(b*b-4*a*c);
if (delta>0)
{
x1=((-b+sqrt(delta))/2*a);
x2= ((-b-sqrt(delta))/2*a);
printf("有两个解!x1=%lf,x2=%lf\n",x1,x2);
}
else if (delta==0)
{
x1=x2=float((-b+sqrt(delta))/2*a);
printf("有两个解!x1=x2=%lf",x1);
}
else
printf("无实数解!");
return 0;
}