学霸看看有什么问题?
#include <stdio.h>
double price(int hours,int distance)
{
double taxiprice=0.0;
double start=13;
double everydistance=2.3;
if(hours<0||hours>24)
{
printf("请输入正确时间\n");
return 0;
}
else if(hours>=5&&hours<23)
{
if(distance>3)
{
taxiprice=start+(distance-3)*everydistance;
}
else
{
taxiprice=start;
}
}
else
{
if(distance>3)
{
taxiprice=start+(distance-3)*everydistance*1.2;
}
else
{
taxiprice=start;
}
taxiprice++;
return taxiprice;
}
int main()
{
int moring=9;
int afternoon=18;
int distance=12;
double taxiprice=0.0;
taxiprice=price(moring,distance)+price(afternoon,distance);
printf("小明每天打车总费用:%f\n",taxiprice);
return 0;
}
}