執(zhí)行完是26,求大神幫看
#include <stdio.h>
float pay(int m,int t)
{
? ? float fee =13;
? ? if(m>=3)
? ? {
? ? ? ? if(t>=23||t<5)
? ? ? ? {
? ? ? ? ? fee+=2.76*(m-3);
? ? ? ? }
? ? ? ?
? ? }
? ? else
? ? {
? ? ? ? if(m>=3)
? ? ? ? {
? ? ? ? ? fee+=2.3*(m-3);
? ? ? ? }
? ? ? ??
? ? }
? ? return fee;
}
int main()
{
? ? printf("小明明天打車的費(fèi)用是%.1f\n",pay(12,9)+pay(12,18));
? ? return 0;
}
2019-09-10
if判斷寫(xiě)反了 油錢沒(méi)加
#include <stdio.h>
float pay(int m,int t)
{
? ? float fee =14;
? ? if(t>=23||t<5)
? ? {
? ? ? ? if(m>=3)
? ? ? ? {
? ? ? ? ? fee+=2.76*(m-3);
? ? ? ? }
? ? }
? ? else
? ? {
? ? ? ? if(m>=3)
? ? ? ? {
? ? ? ? ? fee+=2.3*(m-3);
? ? ? ? }
? ? }
? ? return fee;
}
int main()
{
? ? printf("小明明天打車的費(fèi)用是%.1f\n",pay(12,9)+pay(12,18));
? ? return 0;
}