第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

同學(xué)們幫忙看一下,哪錯(cuò)了啊

#include <stdio.h>

int cost(int distance,int time)

{

? ? double price = 2.3;

? ? double cost;

? ? if(distance<=3){

? ? ? ? cost = 13+1;

? ? }else if(time<=23 && time>5){

? ? ? ? cost = (distance-3)*price+1+13;

? ? }else{

? ? ? ? cost = (distance-3)*(price*1.2)+1+13;

? ? }

}


int main()

{?

? ? double allcost = cost(12,9)+cost(12,18);

? ? printf("小明每天打車(chē)是%f塊錢(qián)",allcost);

? ??

? ??

? ??

? ? return 0;

}


正在回答

2 回答

#include?<stdio.h>
float?cost(int?distance,int?time)
{
????double?price?=?2.3;????
????double?cost;????
????if(distance?<=?3)
????{????????
????????cost?=?13?+?1;????
????}
????else?if(time?<?23?&&?time>=5)
????{????????
????????cost?=?(distance?-?3)?*?price?+?1?+?13;????
????}
????else
????{????
????????cost?=?(distance?-?3)?*?(price?*?1.2)?+?1?+?13;
????}????
????return?cost;
}
int?main()
{
?????double?allcost?=?cost(12,9)+cost(12,18);
?????printf("小明每天打車(chē)是%0.1f塊錢(qián)",allcost);????
?????return?0;
}
1、定義cost函數(shù)為int型卻沒(méi)有返回值,即沒(méi)有return?cost。


0 回復(fù) 有任何疑惑可以回復(fù)我~

#include <stdio.h>


int cost(int distance,int time)


{


? ? double price = 2.3;


? ? double costs;


? ? if(distance<=3){


? ? ? ? costs = 14;


? ? }else if(time<=23 || time>=5){


? ? ? ? costs = (distance-3)*price+1+13;

? ? ? ? printf("白天車(chē)費(fèi)為:%f\n",costs);


? ? }else{


? ? ? ? costs = (distance-3)*(price*1.2)+1+13;

? ? ? ? printf("夜間車(chē)費(fèi)為:%f\n",costs);

? ? }


}


int main()


{?


? ? double allcost = cost(12,9)+cost(12,18);


? ? printf("小明每天打車(chē)是%f塊錢(qián)",allcost);

? ??

? ? return 0;


}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_慕慕9429610 提問(wèn)者

兄弟運(yùn)行一下,還是錯(cuò)的
2019-05-17 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
C語(yǔ)言入門(mén)
  • 參與學(xué)習(xí)       926907    人
  • 解答問(wèn)題       21533    個(gè)

C語(yǔ)言入門(mén)視頻教程,帶你進(jìn)入編程世界的必修課-C語(yǔ)言

進(jìn)入課程

同學(xué)們幫忙看一下,哪錯(cuò)了啊

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)