慕粉2146478508
2017-05-05 22:26
5-14哪位大神会做?求解答
#include<stdio.h>
double totalExpense(int distance,int time)
{
double total=1.0;
if(distance <= 3)
total=13.0;
else
{
if(time>=23 || time<5)
total = 13 + (distance-3)*2.3*1.2;
else
total = 13 + (distance-3)*2.3;
}
return total;
}
int main()
{
int distance1=12,time1=9,distance2=12,time2=18;
double total1=0,total2=0,total=0;
total1 = totalExpense(distance1,time1);
total2 = totalExpense(distance2,time2);
total = total1 + total2;
printf("小明每天的打车费用是%f\n",total);
}
time应该不能作为变量名吧?那个time是不是时间函数呀?
C语言入门
928162 学习 · 21543 问题
相似问题