C语言计算一元二次方程的根.求指出错误#include #include int main(void){float a,b,c,d,x1,x2;char ans;printf("Enter the coefficients of the quadratic equation>");scanf("%f\t%f\t%f",&a,&b,&c);if(a =0 && d >=0){d=pow(b,2)-4*a*c;x1=(-b+sqrt

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 08:55:32
C语言计算一元二次方程的根.求指出错误#include #include int main(void){float a,b,c,d,x1,x2;char ans;printf(");scanf("%f\t%f\t%f",&a,&b,&c);if(a =0 && d >=0){d=pow(b,2)-4*a*c;x1=(-b+sqrt" />

C语言计算一元二次方程的根.求指出错误#include #include int main(void){float a,b,c,d,x1,x2;char ans;printf("Enter the coefficients of the quadratic equation>");scanf("%f\t%f\t%f",&a,&b,&c);if(a =0 && d >=0){d=pow(b,2)-4*a*c;x1=(-b+sqrt
C语言计算一元二次方程的根.
求指出错误
#include
#include
int main(void)
{
float a,b,c,d,x1,x2;
char ans;
printf("Enter the coefficients of the quadratic equation>");
scanf("%f\t%f\t%f",&a,&b,&c);
if(a =0 && d >=0)
{
d=pow(b,2)-4*a*c;
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("x1=%f\tx2=%f",x1,x2);
printf("Do you want to solve another quadratic equation(y/n)?>");
fflush(stdin);
scanf("%c",&ans);
}
else
{
prinft("wrong");
}
return(0);
}
gcc -lm 1.c 之后
出现如下问题
看不懂
Undefined first referenced
symbol in file
prinft /var/tmp//ccEWqWlc.o
ld:fatal:Symbol referencing errors.No output written to a.out
collect2:ld returned 1 exit status

C语言计算一元二次方程的根.求指出错误#include #include int main(void){float a,b,c,d,x1,x2;char ans;printf("Enter the coefficients of the quadratic equation>");scanf("%f\t%f\t%f",&a,&b,&c);if(a =0 && d >=0){d=pow(b,2)-4*a*c;x1=(-b+sqrt
/*结束程序请按“Ctrl+z”*/
#include
#include
int main()
{
float a, b, c;
double d, x1, x2;
printf("Enter the coefficients of the quadratic equation>\n");
while(scanf("%f\t%f\t%f", &a, &b, &c)!=EOF)
{
double d;
d=pow(b,2)-4*a*c;
 if((a!=0&&d>=0)!=EOF)
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("x1=%lf\tx2=%lf\n", x1, x2);
}
printf("Enter the coefficients of the quadratic equation>\n");
}
return 0;
}