大佬們請幫幫忙,先謝謝了
#include <stdio.h>
float cost(float s,int t)
{
? ? float prince;
? ? int first=13+1;
? ? if(0<=s && s<=3)
? ? {
? ? return first;
? ? }
? ? else
? ? {
? ? if(0<=t && t<5 || t==23)
? ? {printf=2.3+2.3*0.2;}
? ? else
? ? {
? ? float cost=first+price*(s-3);
? ? return cost;
? ? }
}
int main()
{
? ? float money=cost(12,9)+cost(12,18);
? ? printf("小明每天打車的總費用%2f元",money);
? ? return 0;
}
大佬們幫忙看一看,找一下錯誤,運行失敗,先謝謝了
2021-07-28
第4行prince應改為price,與后面對應.
第25行printf應改為price,與后面對應
第26行的else(第二個else)應再添加執行塊代碼:{price=2.3;},將多余的{去掉
第46行的printf里的逗號是中文符號,應改為英文,