求各位大佬看看
#include <stdio.h>
float xiaoming(float time ,float distance);//定义时间和距离
{
float price;//定义价格
if(distance>3)
{
if(time >= 5 && time <= 23)//判断是否是白天
{
price = 13+2.3*(distance-3)+1;
return price;
}
else//夜晚
{
price = 13+ 1.2*2.3*(distance - 3)+1;
return price;
}
}
else
{
price = 13 + 1;
return price;
}
}
int main()
{
printf("小明打车花了%f元",xiaoming);
return 0;
}