請教大佬們,提示有一個運行錯誤,麻煩幫忙看一下錯在哪里
#include <stdio.h>
#define PAY 2.3 //每公里2.3元
double SumPay(int times,double distance)
{
? ? if(distance<=3)
? ? return 13+1;? //3公里以內13元起步價
? ? else
? ? {
? ? ? ? if(times>=23||times<=5)
? ? ? ? return (distance-3)*(PAY+2)+13+1;? ?//晚上23點至次日凌晨5點
? ? ? ? else (times>5||times<23)
? ? ? ? return (distance-3)*PAY+13+1;? ?//白天正常時間
? ? }
}
int main()
{
? ? int go_to_work=9,go_off_work=18;? //上下班時間
? ? double distance=12;// 打車距離
? ? double allpay=0;? //每天總費用
? ? allpay+=SumPay(go_to_work,distance);
? ? allpay+=SumPay(go_off_work,distance);
? ? printf("小明每天打車的總費用是:%.2lf",allpay);
? ? return 0;
}
hello.c:?In?function?'SumPay': hello.c:12:9:?error:?expected?';'?before?'return' ?????????return?(distance-3)*PAY+13+1;???//正常時間 ?????????^~~~~~
2019-04-29
else (time>5||times<23) ,括號里的內容,不要吧