?? taxi.txt
字號(hào):
C語(yǔ)言程序課程設(shè)計(jì)出租車計(jì)費(fèi)器
1. 源代碼如下:
# include "stdio.h"
#include "conio.h"
float xiali();
float qirui();
float xuetielong();
float sangtana();
float pay;
main()
{
int model;
float juli,pay;
clrscr();
gotoxy(1,10);
printf("*********************** MENU ********************************\n");
printf("1: Welcome to ride the rental car of xiali \n");
printf("2: Welcome to ride the rental car of qirui \n");
printf("3: Welcome to ride the rental car of xuetielong\n");
printf("4: Welcome to ride the rental car of sangtana\n");
printf("*********************************************************\n");
printf("input model:");
scanf("%d",&model);
printf("input juli:");
scanf("%f",&juli);
switch(model)
{case 1:pay=xiali(juli); break;
case 2:pay=qirui(juli); break;
case 3:pay=xuetielong(juli); break;
case 4:pay=sangtana(juli); break;
}
printf("your pay is:%f\n",pay);
}
float xiali(float distance)
{if (distance<=3)
pay=5;
else
pay=5+(distance-3)*1.2;
return pay;
}
float qirui(float distance)
{ if(distance<=4)
pay=6;
else
pay=6+(distance-4)*1.2;
return pay;
}
float xuetielong(float distance)
{ if(distance<=4)
pay=4;
else
pay=4+(distance-4)*1.2;
return pay;
}
float sangtana(float distance)
{ if(distance<=3)
pay=6;
else
pay=6+(distance-4)*1.2;
return pay;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -