这样的混合型有问题吗?
#include <stdio.h>
int t1,t2;//t1为晚上23点(含)至次日凌晨5点(不含)的打车次数,t2是其他时间的打车次数,
double b, p, a = 2.3;//b为路程,p为费用,a为单价
double GT(int t1, double b)
{
a = a * 1.2;
if (t1>= 1)
{
if (b > 3)
{
p = (13 + a*(b - 3) + 1)*t1;
}
else
{
p = (13 +1)* t1;
}
}
else
{
p = 0;
}
return p;
}
double FT(int t2, double b)
{
a = a * 1.0;
if (t2 >= 1)
{
if (b > 3)
{
p = (13 + a*(b - 3) +1)* t2;
}
else
{
p = (13 +1)* t2;
}
}
else
{
p = 0;
}
return p;
}
int main()
{
printf("打车费用为%lf", FT(2, 12)+GT(0,0));
return 0;
}