慕神9413668
2020-01-17 11:38
啊啊啊啊啊啊
#include <stdio.h>
double payment(int distance,int time)
{ double price;
if(distance<=3)
price=14;
else if(time>=0&&time<5||time>=23&&time<=24)
price=2.3*1.2*(distance-3)+14;
else
price=2.3*(distance-3)+14;
return price;
}
int main()
{
int L,T;
L=12;
T>=9&&T<=18;
double price=payment(L,T);
printf("小明每天打车总费用是%0.2f",price);
return 0;
}
//我这个可以运行
#include <stdio.h>double payment(int distance,int time){ double price; if(distance<=3) price=14; else if(time>=0&&time<5||time>=23&&time<=24) price=2.3*1.2*(distance-3)+14; else price=2.3*(distance-3)+14; return price;}int main(){ int L,T; L=12; T>=9&&T<=18; double price=payment(L,T); printf("小明每天打车总费用是%0.2f",price); return 0;}
最后输出的 printf("每天打车的总费用为%f",qian(12,9)+qian(12,6))中qian(12,6)应是qian(12.18)
C语言入门
926020 学习 · 20793 问题
相似问题