用 double 类型计算最后结果为什么会有一点差距
double money(int s,int t)
{
double M=13;
M+=1;
if (s<3)
{return M;}
double permile=2.3;
if(t>=23||t<5)
{
permile*=1.2;
}
M+=(s-3)*permile;
return M;
}
int main()
{
double cost=money(12,9)+money(12,18);
printf("小明每天的打车费为%f\n",cost);
return 0;
}