課程
/后端開發
/C
/C語言入門
? →_→→_→??
2017-03-19
源自:C語言入門 5-14
正在回答
#include <stdio.h>
int my_charge(float time,double km);
int main()
{
? ? double cost=0;
? ? cost=cost+my_charge(9,12);
? ? cost=cost+my_charge(18,12);
? ? printf("總費用是:%f",cost);?
? ? return 0;
? ??
}
int my_charge(float time,double km)
? ? double danjia=2.3,qibu=13,cost=0;
? ? if(km<=3)
? ? {
? ? ? ? cost=14;
? ? }
? ? else
? ? ? ? cost=13+(km-3)*2.3+1;
? ? if ((time>=23&&time<=24)||(time>=0&&time<=6))
? ? ? ? cost=cost*1.2;
? ? return cost;
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
1 回答不能下載訓練題
2 回答5.13的任務怎么搞
5 回答課后題
1 回答課后答案
2 回答最后的綜合練習
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-03-19
#include <stdio.h>
int my_charge(float time,double km);
int main()
{
? ? double cost=0;
? ? cost=cost+my_charge(9,12);
? ? cost=cost+my_charge(18,12);
? ? printf("總費用是:%f",cost);?
? ? return 0;
? ??
}
int my_charge(float time,double km)
{
? ? double danjia=2.3,qibu=13,cost=0;
? ? if(km<=3)
? ? {
? ? ? ? cost=14;
? ? }
? ? else
? ? {
? ? ? ? cost=13+(km-3)*2.3+1;
? ? }
? ? if ((time>=23&&time<=24)||(time>=0&&time<=6))
? ? {
? ? ? ? cost=cost*1.2;
? ? }
? ? return cost;
}