大家算出来的值为多少?
#include <stdio.h>
float getCosts(int time,int kms)
{//计算费用,time时间,kms距离
float bCosts=13;//起步价
int i=1;//燃油费
float costs;//总费用
if(time>=5&&time<23)
{//如果打车时间在5点到23点
costs = bCosts + (kms-3)*2.3 + i;
}
else
{
costs = bCosts + (kms-3)*2.3*1.2 +i;
}
return costs;//返回费用
}
int main()
{
printf("小明打车费用:%f",getCosts(9,12)+getCosts(6,12));
return 0;
}