解决运费问题时,程序未被检查出错,可是无法正常运行,得出结果。
#include<stdio.h>void main()
{
double mass,free;
int choice,n;
printf("please input the 质量 ");
scanf("%.3lf",&mass);
printf("please do a choice,if speed up or not");//*输入1或0,1代表加速*//
scanf("%d",&choice);
switch(choice)
{
case 1:free=2.00;break;
case 0:free=0.00;
}
n=(int)(mass+0.99);
if(mass<=1)
free=free+0.80;
else free=free+(n/1-1)*0.50+0.80;
printf("%.3lf",free);
}