慕斯0452495
2021-07-21 20:44
#include <stdio.h>
double cost(double s,double t)//定义路程 时间
{
int money;
if(5<=t<23)//白天的价钱
{
if(0 <= s <= 3)
{
money = (13+1);
}
else
{
money = (13+1)+(s-3)*2.3;
}
}
else//晚上的价格
{
if(0 <= s <= 3)
{
money = (13+1);
}
else
{
money = (13+1)+(s-3)*2.3*1.2;
}
}
return money;
}
int main()
{
printf("小明打车总费用%f\n",cost(12,9),cost(12,18));
return 0;
}
double money
if( s <= 3)
printf("小明打车总费用%f\n",cost(12,9)+cost(12,18))
C语言入门
926021 学习 · 20793 问题
相似问题