不知道是哪里错了.错误error C2065:'printf' :undeclared identifier#include main() {float a,b,c,disc,x1,x2,p,q;scanf("a=%f,b=%f,c=%f",&a,.&b,&c);disc=b*b-4*a*c;p=-b/(2*a);q=sqrt(disc)/(2*a);x1=p+q;x2=p-q;printf("\n\nx1=%5.2f\nx2=%5.2f\n",x1,x2

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 12:17:47

不知道是哪里错了.错误error C2065:'printf' :undeclared identifier#include main() {float a,b,c,disc,x1,x2,p,q;scanf("a=%f,b=%f,c=%f",&a,.&b,&c);disc=b*b-4*a*c;p=-b/(2*a);q=sqrt(disc)/(2*a);x1=p+q;x2=p-q;printf("\n\nx1=%5.2f\nx2=%5.2f\n",x1,x2
不知道是哪里错了.错误error C2065:'printf' :undeclared identifier
#include
main()
{
float a,b,c,disc,x1,x2,p,q;
scanf("a=%f,b=%f,c=%f",&a,.&b,&c);
disc=b*b-4*a*c;
p=-b/(2*a);
q=sqrt(disc)/(2*a);x1=p+q;x2=p-q;
printf("\n\nx1=%5.2f\nx2=%5.2f\n",x1,x2);
return 0;
}
加#include 试过了.不顶用,还多了个错误.

不知道是哪里错了.错误error C2065:'printf' :undeclared identifier#include main() {float a,b,c,disc,x1,x2,p,q;scanf("a=%f,b=%f,c=%f",&a,.&b,&c);disc=b*b-4*a*c;p=-b/(2*a);q=sqrt(disc)/(2*a);x1=p+q;x2=p-q;printf("\n\nx1=%5.2f\nx2=%5.2f\n",x1,x2
LZ这样改就可以了,0 error 0warning
#include //这里不要忘记加头文件,如果你是在VC6.0里面运行的话,如果是Turbo c就不用
#include
void main() {
double a,b,c,disc,x1,x2,p,q;//这里面都定义成double,因为sqrt这个函数是针对double的
scanf("a=%lf,b=%lf,c=%lf",&a,&b,&c);//这里LZ写的时候,在b前面多加了个.下定要注意,正因为定义成了double所以输入形式也要变成%lf
disc=b*b-4*a*c;
p=-b/(2*a);
q=sqrt(disc)/(2*a);
x1=p+q;
x2=p-q;
printf("x1=%.2f,x2=%.2f\n",x1,x2);//这里直接用.2就可以保留二位小数了
}