#include<stdio.h>标签:语句,case,运费,break,switch,printf,输入 From: https://blog.51cto.com/u_15841203/5901809
int main()
{
int x, y,s,w;
double d, p,f;
printf("请输入距离s,基本运费,货物重:");
scanf("%d%lf%d", &s,&p,&w);
x = s / 1000;
y = s / 250;
switch (x)
{
case 1:
d = 0.08;
break;
case 2:
d = 0.1;
break;
case 3:
d = 0.15;
break;
case 0:
switch (y)
{
case 0:
d = 0;
break;
case 1:
d = 0.02;
break;
case 2:
d = 0.05;
break;
}
default:
printf("里程数输入错误");
break;
}
f = p * w * s * (1 - d);
printf("f=%10.2lf\n", f);
return 0;
}