課程
/后端開發
/C
/C語言入門
為啥jackresult只有放在最后才能執行?
2016-05-10
源自:C語言入門 5-5
正在回答
#include <stdio.h>
float taxifee(int clock,int miles){??? float money;??? if(miles<=3)??? {??????? money=14;??????? printf("費用為14\n");??? }??? else??? {??????? if(clock>=23 || clock<5)??????? {??????????? money=13+1+2.3*(miles-3)*1.2;??????????? printf("夜間車費為:%f\n",money);??????? }??????? else??????? {??????????? money=13+1+2.3*(miles-3);??????????? printf("日間車費為:%f\n",money);??????? }??? }??? ??? return money;??? }int main(){??? printf("打的總費用:%.1f\n",taxifee(9,12)+taxifee(18,12));??? return 0;}
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
1 回答不會阿................
2 回答m=n=2阿。。
2 回答大佬求解阿
2 回答我不是阿斗
5 回答哪里錯了阿?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-05-11
#include <stdio.h>
float taxifee(int clock,int miles)
{
??? float money;
??? if(miles<=3)
??? {
??????? money=14;
??????? printf("費用為14\n");
??? }
??? else
??? {
??????? if(clock>=23 || clock<5)
??????? {
??????????? money=13+1+2.3*(miles-3)*1.2;
??????????? printf("夜間車費為:%f\n",money);
??????? }
??????? else
??????? {
??????????? money=13+1+2.3*(miles-3);
??????????? printf("日間車費為:%f\n",money);
??????? }
??? }
???
??? return money;???
}
int main()
{
??? printf("打的總費用:%.1f\n",taxifee(9,12)+taxifee(18,12));
??? return 0;
}