感觉一切都没什么问题,可是输出来好几百万
#include <stdio.h>
int distance = 12;
int x;
float y,fee1,fee2;
int main()
{
basicfee();
fee1 = time1(6);
fee2 = time1(9);
float sum = fee1 + fee2;
printf("小明每天打车总费用为%f元", sum);
return 0;
}
float time1(int t)
{
if (t >= 23 || t <= 5)
y *= 1.2;
return y;
}
float basicfee()
{
x = distance;
if (x <= 3)
{
y = 13;
}
else
{
y = 13 + (x - 3) * 2.3;
}
return y;
}