为什么这样算不对啊?
#include <stdio.h>double cost(int x,int time){ //x为路程
double y; //y为费用
if(x <= 3 && 0 <= time <= 24){
y = 13 + 1;
}else if(x > 3){
if(time < 5 || time > 23) {
y = 13 + 1 + 2.3*1.2*(y - 3);
}
else if(time >= 5 || time <= 23){
y = 13 + 1 + 2.3*(y - 3);
}
}
}
int main(){
printf("打车总费用为:%f",cost(12,9)+cost(12,18));
return 0;}