求指出錯誤!
/249/5642/FPjs/hello.c: In function 'taixfee': /249/5642/FPjs/hello.c:29:1: error: expected declaration or statement at ?錯了什么。。求指出!
/249/5642/FPjs/hello.c: In function 'taixfee': /249/5642/FPjs/hello.c:29:1: error: expected declaration or statement at ?錯了什么。。求指出!
2016-07-24
舉報
2016-11-21
#include <stdio.h>//頭文件
float Cost(int gl,int time)//定義函數,gl為路程,time為時間
{
??? float a = 2.3;//每公里的計費單價
??? int b = 13;//起步價
??? int c = 1;//燃油費
??? int d = 3;//包含路程
??? double money;//花費
???
??? if( gl > 3 )//判斷距離
??? {
??? ?if(time<5||time>=23)//判斷時間是否為晚上
??{
???money = b + ( gl - d ) * a * 1.2 + c ;
??}//判斷句
??else if(time>=5||time<23)//判斷時間是否為白天
??{
???money = b + ( gl - d ) * a + c ;
??}//判斷句
??else //3公里以下早晚都是一樣的價錢
??????? {
???money = b + c ;?
??}? //判斷句
??? }
??? return money;//計算出的花費返回函數
}
???
int main()
{
??? float sum = Cost(12,9)+Cost(12,18) ;//定義總路費
??? printf("小明每天打車的總路費為:%.2f元\n",sum);//輸出
??? return 0;
}
2016-07-25
額。。。你應該把你的代碼截圖出來啊