哪里出错了?编译器没报错。
#include <stdio.h>void main()
{
int s;
double p,w,d,f;
scanf("&lf &lf %d",&p,&w,&s);
if(s >= 3000)
{
d = 0.15;
}
else
{
switch(s / 250)
{
case 0:
d=0;
break;
case 1:
d=0.02;
break;
case 2:
case 3:
d=0.05;
break;
case 4:
case 5:
case 6:
case 7:
d=0.08;
break;
case 8:
case 9:
case 10:
case 11:
d=0.1;
break;
}
}
f = p * w * s *(1.0 - d);
printf("freight = %lf\n",f);
} scanf语句, 是%lf 不是 &lf。 解决了,thank very much!
页:
[1]