c程序设计第三版中例题5.7,在dev-c++上运行的结果,跟书本上给出的不同
#include<stdio.h>void main()
{
int c,s;
float p,w,d,f;
scanf("%f,%f,%f",&p,&w,&s);
if(s>=3000)c=12;
else c=s/250;
switch(c)
{
case 0:d=0;break;
case 1:d=2;break;
case 2:
case 3:d=5;break;
case 4:
case 5:
case 6:
case 7:d=8;break;
case 8:
case 9:
case 10:
case 11:d=10;break;
case 12:d=15;break;
}
f=p*w*s*(1-d/100.0);
printf("freight=%15.4f\n",f);
}
书中给出输入100,20,300
输出应该是freight= 588000,0000
实际输出是freight=19276365824.0000