旗开得胜wds
2016-10-22 21:06
运行不对,求解释
#include <stdio.h>
float money;
float Least = 13.0;
float tickets(float distance,float time)
{
if(time>=5.0&&time<=23.0)
{
if(distance<=3.0)
{
return (Least+1);
}
else
{
money=Least+2.3*(distance-3)+1;
return money;
}
}
else
{
if(distance<=3.0)
{
return (Least+1);
}
else
{
money=Least+1.2*2.3*(distance-3)+1;
return money;
}
}
}
int main()
{
float tickets1 = tickets(12.0,8.0);
float tickets2 = tickets(12.0,6.0);
printf("每天打车总费用为:%.2f\n",tickets1+tickets2);
return 0;
}
#include <stdio.h> float money; float Least = 13.0; float tickets(float distance,float time) { if(time>=5.0&&time<=23.0) { if(distance<=3.0) { return (Least+1); } else { money=Least+2.3*(distance-3)+1; return money; } } else { if(distance<=3.0) { return (Least+1); } else { money=Least+1.2*2.3*(distance-3)+1; return money; } } } int main() { float tickets1 = tickets(12.0,8.0); float tickets2 = tickets(12.0,6.0); printf("每天打车总费用%f为:",tickets1+tickets2); return 0; }
C语言入门
926207 学习 · 20797 问题
相似问题