慕粉155617866
2017-03-19 16:30
→_→→_→
#include <stdio.h>
int my_charge(float time,double km);
int main()
{
double cost=0;
cost=cost+my_charge(9,12);
cost=cost+my_charge(18,12);
printf("总费用是:%f",cost);
return 0;
}
int my_charge(float time,double km)
{
double danjia=2.3,qibu=13,cost=0;
if(km<=3)
{
cost=14;
}
else
{
cost=13+(km-3)*2.3+1;
}
if ((time>=23&&time<=24)||(time>=0&&time<=6))
{
cost=cost*1.2;
}
return cost;
}
C语言入门
926027 学习 · 20793 问题
相似问题