野生的经验君
2015-06-30 14:39
#include <stdio.h>
int main()
{
int distance= 12 , price=2.3, Time =9||18 , n=2 ;
float total;
{
if(Time < 5||(Time>=23&&Time<24))
{
if(distance<=3)
total = 13;
else
total =( distance - 3 )*price*1.2 + 13;
}
else
{
if(distance <= 3)
total = 13;
else
total =(distance - 3)*price + 13;
}
}
total =(total+ 1 )*n;
printf("小明每天打车的总费用为:%f元。",total);
//我自己算出来是69.4,可是结果不一样
return 0;
}
#include <stdio.h>
int main()
{
int distance= 12 ,Time=9, n=2 ;
float total;
float price=2.3;
{
if(Time < 5||(Time>=23&&Time<24))
{
if(distance<=3)
total = 13;
else
total =( distance - 3 )*price*1.2 + 13;
}
else
{
if(distance <= 3)
total = 13;
else
total =(distance - 3)*price + 13;
}
}
total =(total+ 1 )*n;
printf("小明每天打车的总费用为:%f元。",total);
//我自己算出来是69.4,可是结果不一样
return 0;
}
这样就好了。不过结果是69.399994
int Time =9||18,第一次看到可以这么定义
C语言入门
926020 学习 · 20793 问题
相似问题