为了账号安全,请及时绑定邮箱和手机立即绑定

为啥小数点后多了个1求大神指点

#include <stdio.h>

float money(int s,int h)

{

    float cost;

    if(s<=3)

    {

        cost=14;

    }

    else 

    {

       if((h>=23)&&(h<=24)||(h<=5)&&(h>=0)) 

       {

           cost=14+(s-3)*2.3*1.2;

           

       }

       else

       {

           cost=14+(s-3)*2.3;

           

       }

       printf("小明打车花费:%f\n",cost);

       return cost;

    }

    

    

    

    

}

int main()

{

    float num=money(12,9)+money(12,18);

    printf("all the cost is:%f\n",num);

    return 0;

}


正在回答

举报

0/150
提交
取消
C语言入门
  • 参与学习       924408    人
  • 解答问题       20753    个

C语言入门视频教程,带你进入编程世界的必修课-C语言

进入课程

为啥小数点后多了个1求大神指点

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信