doctorwho
2017-10-22 16:29
#include <stdio.h>
int getprice(time,distance)
{
double perprice;
double totalprice;
if(time>5&&time<23)
{
perprice=2.3;
}
else
{
perprice=2.3*1.2;
}
if(distance>3)
{
totalprice=(distance-3)*perprice+13;
}
else
{
totalprice=13;
}
return totalprice;
}
int main()
{
int morning=9;
int evening=18;
int diatance=12;
double totalprice=0
totalprice=getprice(morning,distance)+getprice(evening,diatance);
return 0;
}
燃油费
C语言入门
926211 学习 · 20797 问题
相似问题