2025-03-06 23:47:59 +08:00

24 lines
578 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
【程序填空】---------------------------------------------------------
功能计算武汉城区出租车收费的程序当里程在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);
}