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

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

大神速來!5-14的綜合練習(xí),跑不出來,錯(cuò)在哪?

#include?<stdio.h>
float?price(int?dictance,int?useTime)
{
???int?startPrice?=?13;
???float?fuel?=?1;
???float?milePrice?=?2.3;
???float?totalPrice;
???while(useTime<5||useTime>=23)
???{
???????if(useTime<0||useTime>24)
???????{
???????????printf("%s\n","時(shí)間輸入有誤。");
???????????return?0;
???????????break;
???????}
???????else
???????{
???????????milePrice*=1.2;
???????????break;
???????}
???}
???if(distance<=3)
???{
???????totalprice?=?startPrice+fuel;
???}
???else
???{
???????totalPrice?=?startPrice+milePrice*(dictance-3)+fuel;
???}
???return?totalPrice;
}

int?main()
{
???int?amTime?=?9;
???int?pmTime?=?18;
???int?distance?=?12;
???printf("小明上午打車的費(fèi)用是%f\n",price(distance,amTime));
???printf("小明下午打車的費(fèi)用是%f\n",price(distance,pmTime));
???printf("小明打車的總費(fèi)用是%f\n",price(distance,amTime)+price(distance,pmTime));
???return?0;
}

運(yùn)行結(jié)果如下:

/249/5642/CD9l/hello.c: In function 'price':
/249/5642/CD9l/hello.c:22:8: error: 'distance' undeclared (first use in this function)
? ? if(distance<=3)
? ? ? ?^
/249/5642/CD9l/hello.c:22:8: note: each undeclared identifier is reported only once for each function it appears in
/249/5642/CD9l/hello.c:24:9: error: 'totalprice' undeclared (first use in this function)
? ? ? ? totalprice = startPrice+fuel;

正在回答

2 回答

小心使得萬年船

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

原來是distance誤寫成dictance,同時(shí)totalPrice的P小寫成p了,太粗心!

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

舉報(bào)

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

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

進(jìn)入課程

大神速來!5-14的綜合練習(xí),跑不出來,錯(cuò)在哪?

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

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

幫助反饋 APP下載

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

公眾號

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