課程
/后端開發(fā)
/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èi)用是:%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;
舉報(bào)
C語言入門視頻教程,帶你進(jìn)入編程世界的必修課-C語言
1 回答不能下載訓(xùn)練題
2 回答5.13的任務(wù)怎么搞
5 回答課后題
1 回答課后答案
2 回答最后的綜合練習(xí)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
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èi)用是:%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;
}