#include <stdio.h>
float money(n,shijian)
{
float num=0;
if(n<=3)
printf("打车费用为14");
else
{
if(shijian<=23&&shijian>=5)
{
n=n-3;
num=n*2.3*1.2+14;
printf("打车费用为%f\n",num);
}
else
{
n=n-3;
num=n*2.3+14;
printf("打车费用为%f\n",num);
}
return num;
}
}
int main()
{
printf("花了钱%f",money(12,9)+money(12,18));
return 0;
}
if(shijian<=23&&shijian>=5)不应该是if(shijian>=23&&shijian<=5)吗?因为凌晨23-5点准确算是23~24、0~5呀