琉璃星
2015-12-27 10:45
#include <stdio.h>
int getmMile(int hour,int mile )
{ int money;
if(mile<=3)
{ money=13;}
else
{ if(hour>=23&&hour<5)
{ money=13+(hour-3)*(2.3*1.2);
}
else
{money=13+(hour-3)*2.3;
}
}
}
int main()
{ int money1=geymMile(9,12)+1;
int money2=getmMile(6,12)+1;
printf("%d %d",money1,money2);
return 0;
}
#include <stdio.h>
double x(double hour,double mile )
{ double money;
if(mile<=3)
{ money=13;}
else
{ if(hour>=23&&hour<5)
money=13+(mile-3)*(2.3*1.2);
else
money=13+(mile-3)*2.3;
}
return money;
}
int main()
{ double money1=x(9,12)+1;
double money2=x(18,12)+1;
printf("%.6lf %.6lf",money1,money2);
return 0;
}
float money1 = ..;
float money2 = ..;
printf("%.6f %.6f",money1,money2);
C语言入门
926020 学习 · 20793 问题
相似问题