最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

大神速來!5-14的綜合練習,跑不出來,錯在哪?

#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","時間輸入有誤。");
???????????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\n",price(distance,amTime));
???printf("小明下午打車的費用是%f\n",price(distance,pmTime));
???printf("小明打車的總費用是%f\n",price(distance,amTime)+price(distance,pmTime));
???return?0;
}

運行結果如下:

/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 回復 有任何疑惑可以回復我~

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

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

舉報

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

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

進入課程

大神速來!5-14的綜合練習,跑不出來,錯在哪?

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

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

幫助反饋 APP下載

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

公眾號

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