亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

我這是哪錯了啊

#include <stdio.h>
double money(float dis,float ofhour)
{
??? float money;
??? if(dis<=3)
??? {
??????? money=14;
??? }
??? else if(dis>3)
??? {
??????? if(ofhour>=5&&ofhour<23)
??????? {
??????????? money=(dis-3)*2.3+14;
??????? }
??????? else if
??????? {?
??????????? money=(dis-3)*2.3*(1+0.2)+14;
??????? }
??? }
??? return money;
}
int main()
{
??? printf("小明打車費用為%.1f\n",texifee(12,9)+texifee(12,6));
??? return 0;
}

正在回答

2 回答

#include<stdio.h>

double getMoney(int dis,int hours)

{

double totalMoney=0.00;

double per=2.30;

double sta=13.00;

if(hours<0||hours>24)

{

printf("請輸入正確的數字:");

return 0;

}

else if(!(hours>=5&&hours<23))

{

per*=1.2;

}

if(dis<=3)

{

totalMoney=sta;

}

else

{

totalMoney=sta+(dis-3)*per;

}

totalMoney++;

return totalMoney;

}

int main()

{

double totalMoney=0.00;

int mor=9;

int aft=18;

int dis=12;

double per=2.30;

totalMoney=getMoney(dis,mor)+getMoney(dis,aft);

printf("小明的搭車費用為:%.2f\n",totalMoney);

return 0;

}


0 回復 有任何疑惑可以回復我~

#include <stdio.h>

double money(float dis,float ofhour)

{

? ? float money;

? ? if(dis<=3)

? ? {

? ? ? ? money=14;

? ? }

? ? else if(dis>3)

? ? {

? ? ? ? if(ofhour>=5&&ofhour<23)

? ? ? ? {

? ? ? ? ? ? money=(dis-3)*2.3+14;

? ? ? ? }

? ? ? ? else

? ? ? ? { ?

? ? ? ? ? ? money=(dis-3)*2.3*(1+0.2)+14;

? ? ? ? }

? ? }

? ? return money;

}

int main()

{

? ? printf("小明打車費用為%.1f\n",texifee(12,9)+texifee(12,6));

? ? return 0;

}

? 把if ?那段代碼里面的if刪除一個 ? 還有?你輸出里面的texifee ?是沒給出??

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
C語言入門
  • 參與學習       926905    人
  • 解答問題       21533    個

C語言入門視頻教程,帶你進入編程世界的必修課-C語言

進入課程

我這是哪錯了啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號