C语言 求ax2+bx+c=0方程的根运行错误 ,#include #include void main(){float a,b,c,d,x1,x2;d=b*b-4*a*c;printf("Please Enter 3 Numbers.\n");scanf("%f,%f,%f",a,b,c);x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if(d
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/12 19:36:11
C语言 求ax2+bx+c=0方程的根运行错误 ,#include #include void main(){float a,b,c,d,x1,x2;d=b*b-4*a*c;printf("Please Enter 3 Numbers.\n");scanf("%f,%f,%f",a,b,c);x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if(d
C语言 求ax2+bx+c=0方程的根
运行错误 ,
#include
#include
void main()
{
float a,b,c,d,x1,x2;
d=b*b-4*a*c;
printf("Please Enter 3 Numbers.\n");
scanf("%f,%f,%f",a,b,c);
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
if(d
C语言 求ax2+bx+c=0方程的根运行错误 ,#include #include void main(){float a,b,c,d,x1,x2;d=b*b-4*a*c;printf("Please Enter 3 Numbers.\n");scanf("%f,%f,%f",a,b,c);x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if(d
总结上面两位的说法:
#include
#include
void main()
{
float a,b,c,d,x1,x2;
(1)//////////////////////////////d=b*b-4*a*c;
printf("Please Enter 3 Numbers.\n");
(2)/////////////////////////////scanf("%f,%f,%f",a,b,c);
scanf("%f,%f,%f",&a,&b,&c);
d=b*b-4*a*c;
x1=(-b+sqrt(d))/(double)(2*a);
//vc为确保精度,默认的都是double类型.
x2=(-b-sqrt(d))/(double)(2*a);
if(d