运行出来0.000000,有没有大佬帮解决一下
#include <stdio.h>
float cost(float gotime,float backtime)
{
float cost1,cost2,num;
if(gotime>=5&&gotime<23)//白天
{
cost1=13+1+(12-3)*2.3; //13+1+(12-3)*2.3
}
else
{
cost1=13+1+(12-3)*1.2*2.3;
}
if(backtime>=23&&backtime<=24||backtime>=0&&backtime<5)//晚上
{
cost2=13+1+(12-3)*1.2*2.3; //13+1+(12-3)*1.2*2.3
}
else
{
cost2=13+1+(12-3)*2.3;
}
num=cost1+cost2;
return num;
}
int main()
{
float num;
cost(9,18);
printf("小明每天打车的总费用为:%f",num);
}