又有问题?这是我自己敲的。可是为什么出现“未定义标识符”问题,求修改。
# include <stdio.h># include <math.h>
int main(void)
{
printf("请输入三个系数a,b,c:\n");
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
double delat;
double x1;
double x2;
delat = b*b - 4*a*c;
if (delat > 0)
{
x1 = (-b + sprt(delat)) / (2*a);
x2 = (-b - sprt(delat)) / (2*a);
printf("该一元二次方程有两解, x1 = %f, x2 = %f\n", x1, x2);
}
else if (delat == 0)
{
x1 = (-b) / (2*a);
x2 = x1;
printf("该一元二次方程有唯一解, x1 = x2 = %f\n", x1);
}
else
{
printf("该一元二次方程无解\n");
}
return 0;
}