大佬们,如何简化、改正这个代码?十分感谢!(运行结果是64,好像不对/哭)
#include <stdio.h>
int money;
int perFee;
int money1;
int money2;
int allMoney;
int getTime(int time)
{
if (5 < time < 23)
{
perFee = 2.3;
}
else
{
perFee = 2.3 * 1.2;
}
return perFee;
}
int getDistance(int distance)
{
if (distance <= 3)
{
money = 13;
}
else
{
money = 13 + (distance - 3)*perFee;
}
return money;
}
int main()
{
getTime(9);
getDistance(12);
money1 = money;
getTime(18);
getDistance(12);
money2 = money;
allMoney = money1 + money2 + 1 + 1;
printf("小明每天打车总费用为%d\n。", allMoney);
return 0;
}