Files
class-notes/2207/天天乐学答案/源码/C语言-1/7.c
T
2025-03-06 23:47:59 +08:00

24 lines
578 B
C

/*-------------------------------------------------------
【程序填空】---------------------------------------------------------
功能:计算武汉城区出租车收费的程序,当里程在3公里以内含3公里时收费12元,超过3公里(在0和1之间均计1公里)的部分每公里收费2元。
备注:使用switch来实现
--------------------------------------------------------*/
#include<stdio.h>
main(){
int m,n;
scanf("%d",&m);
/**********Program**********/
n=0;
switch(m){
default: n+=(m-3)*2;
case 1:
case 2:
case 3:n+=12;
}
/********** End **********/
printf("本次收费为:%d",n);
}