感觉没啥问题,哪里错了呢。。。
#include <stdio.h>
double money(double l,double t)
{
double m;
if(5<t&&t<=23)
{
m=2.3*l+13+1;
return m;
}
else
if((0<=t&&t<=5)||(23<t&&t<=24))
{
m=2.3*1.2*l+13+1;
return m;
}
else
{
printf("输入错误!");
return 0;
}
}
int main()
{
double t1,t2,l;
printf("上班时间:");
scanf("%f\n",&t1);
printf("下班时间:");
scanf("%f\n",&t2);
printf("输入距离:");
scanf("%l\n",&l);
printf("上班的车费:%f\n",money(l,t1));
printf("下班的车费:%f\n",money(l,t2));
printf("一天的总车费:%f\n",money(l,t1+t2));
return 0;
}