#includevoid main(){double p,w,a,d,f;scanf("%lf %lf %lf",&p,&w,&a);{if a>=3000 d=15;else if a>=2000 d=10;else if a>=1000 d=8;else if a>=500 d=5;else if a>=250 d=2;else d=0;}f=p*w*a*(1-d/100);printf("%lf",f);}--------------------Configuration:r1 - Win

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/31 21:04:02
#includevoid main(){double p,w,a,d,f;scanf(=3000 d=15;else if a>=2000 d=10;else if a>=1000 d=8;else if a>=500 d=5;else if a>=250 d=2;else d=0;}f=p*w*a*(1-d/100);printf("%lf",f);}--------------------Configuration:r1 - Win" />
xn0_*K*73$-&Ng9h:iv!qwCe=HRFX/_ؼu2Ǐ]4.)j O Ѕ:yJYe ,cQVs]u6Q"~H@ ԋQdunȑԭ䕤+ LE,ʭZꂣ0vc#0S P);6}|Y2uOsiHH H0ٙiLSU_I<b\7&ERpS4M4syin O\ʡP&"m>c92KXD=JXk@&}>$4({ّYr>6Vc>#dtV݉tp|z|t|2ΓlK܈P ,S h$}w>?<\zdxY:8b07p}~~-Z1kC ٣C6

#includevoid main(){double p,w,a,d,f;scanf("%lf %lf %lf",&p,&w,&a);{if a>=3000 d=15;else if a>=2000 d=10;else if a>=1000 d=8;else if a>=500 d=5;else if a>=250 d=2;else d=0;}f=p*w*a*(1-d/100);printf("%lf",f);}--------------------Configuration:r1 - Win
#include
void main()
{
double p,w,a,d,f;
scanf("%lf %lf %lf",&p,&w,&a);
{
if a>=3000 d=15;
else if a>=2000 d=10;
else if a>=1000 d=8;
else if a>=500 d=5;
else if a>=250 d=2;
else d=0;
}
f=p*w*a*(1-d/100);
printf("%lf",f);
}
--------------------Configuration:r1 - Win32 Debug--------------------
Compiling...
r1.cpp
D:\试练\r1.cpp(7) :error C2061:syntax error :identifier 'a'
D:\试练\r1.cpp(8) :error C2181:illegal else without matching if
D:\试练\r1.cpp(8) :error C2061:syntax error :identifier 'a'
D:\试练\r1.cpp(9) :error C2181:illegal else without matching if
D:\试练\r1.cpp(9) :error C2061:syntax error :identifier 'a'
D:\试练\r1.cpp(10) :error C2181:illegal else without matching if
D:\试练\r1.cpp(10) :error C2061:syntax error :identifier 'a'
D:\试练\r1.cpp(11) :error C2181:illegal else without matching if
D:\试练\r1.cpp(11) :error C2061:syntax error :identifier 'a'
D:\试练\r1.cpp(12) :error C2181:illegal else without matching if
执行 cl.exe 时出错.
r1.obj - 1 error(s),0 warning(s)
这是怎么了?

#includevoid main(){double p,w,a,d,f;scanf("%lf %lf %lf",&p,&w,&a);{if a>=3000 d=15;else if a>=2000 d=10;else if a>=1000 d=8;else if a>=500 d=5;else if a>=250 d=2;else d=0;}f=p*w*a*(1-d/100);printf("%lf",f);}--------------------Configuration:r1 - Win
if a>=3000 改成 if (a>=3000),后面的if都要改.