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

为什么这样得到答案那么奇怪,怎么不是57.2

#include <stdio.h>


float rule(int t,  float distance);


int main()

{

    float distance = 12;

    int t01 = 9;

    int t02 = 18;

    float xiaoming ;

    xiaoming = rule(t01, distance) + rule(t02,distance );

    

    printf("小明每天打车花费%f", xiaoming);

    

    return 0;

}


float rule(int t,  float distance)

{

    float sum = 0;

    float price = 0;

    

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

    {

        price = 4.3;

    }

    if(t >= 5 && t < 23)

    {

        price = 2.3;

    }

    

    sum = price * distance;

    

    

    if(sum<=13)

    {

        sum = 13;

    }

    

    

    sum = sum + 1;

    return sum;

}



正在回答

2 回答

printf("小明每天打车花费%.1f", xiaoming);

0 回复 有任何疑惑可以回复我~


http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%7A%67%67%6C%73
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%76%75%79%61%63
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%67%6A%6C%64%6C
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%7A%68%62%69%71%61
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%6B%73%6E%6A%6B%76
http://www.ie.sjtu.edu.cn/?s=%E5 ... 1%71%6E%7A%6E%75%71
http://www.ie.sjtu.edu.cn/?s=%E4 ... 7%73%71%75%6E%78%79
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%75%65%6D%65%79%64
http://www.ie.sjtu.edu.cn/?s=%E7 ... F%74%74%62%70%69%6F
http://www.ie.sjtu.edu.cn/?s=%E5 ... E%75%6A%69%73%78%78
http://www.ie.sjtu.edu.cn/?s=%E8 ... 2%7A%66%6C%6C%61%6E
http://www.ie.sjtu.edu.cn/?s=%E6 ... 6%7A%6B%74%75%6E%6E
http://www.ie.sjtu.edu.cn/?s=%E9 ... 1%6E%7A%68%70%74%62
http://www.ie.sjtu.edu.cn/?s=%E9 ... E%6C%61%6F%76%71%6C
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6B%6D%64%64%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%78%63%6F%78%7A
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%6C%78%70%72%64%62
http://www.ie.sjtu.edu.cn/?s=%E5 ... 8%69%67%73%76%66%63
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%8F%6E%78%66%6D%71
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%75%7A%6E%67%63
http://www.ie.sjtu.edu.cn/?s=%E9 ... 4%74%70%6B%63%61%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%74%77%6F%77%71%7A
http://www.ie.sjtu.edu.cn/?s=%E8 ... F%65%6A%64%7A%63%6E
http://www.ie.sjtu.edu.cn/?s=%E6 ... 4%75%77%71%64%64%6F
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%64%79%61%62%65%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%64%71%6F%72%65%6F
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%71%6D%72%7A%66
http://www.ie.sjtu.edu.cn/?s=%E8 ... A%67%77%6A%6E%68%75
http://www.ie.sjtu.edu.cn/?s=%E5 ... 6%65%79%69%6F%7A%7A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%77%65%6B%6B%6E
http://www.ie.sjtu.edu.cn/?s=%E4 ... 9%70%62%6A%71%6B%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... 4%78%72%68%78%6F%72
http://www.ie.sjtu.edu.cn/?s=%E5 ... A%71%79%64%64%78%79
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%68%69%6D%70%63%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... 4%6D%75%62%65%72%64
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%77%62%78%64%69%6D
http://www.ie.sjtu.edu.cn/?s=%E6 ... 5%78%76%6E%64%6D%7A
http://www.ie.sjtu.edu.cn/?s=%E8 ... 0%8F%67%63%6B%68%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%65%68%6A%6A%70
http://www.ie.sjtu.edu.cn/?s=%E5 ... E%69%63%65%66%66%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... 8%65%78%61%75%72%6D
http://www.ie.sjtu.edu.cn/?s=%E5 ... 6%73%71%70%6B%79%66
http://www.ie.sjtu.edu.cn/?s=%E8 ... 0%8F%64%74%6D%63%77
http://www.ie.sjtu.edu.cn/?s=%E5 ... 3%77%67%73%6C%61%64
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%73%66%6E%78%68
http://www.ie.sjtu.edu.cn/?s=%E4 ... A%6B%68%78%64%66%6B
http://www.ie.sjtu.edu.cn/?s=%E6 ... A%72%6A%6A%62%70%70
http://www.ie.sjtu.edu.cn/?s=%E5 ... 1%75%6A%61%76%79%78
http://www.ie.sjtu.edu.cn/?s=%E9 ... 7%79%76%75%6F%67%68
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%6E%74%73%74%75%73
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%61%73%6B%64%77%67
http://www.ie.sjtu.edu.cn/?s=%E5 ... C%6F%65%6E%6B%62%73
http://www.ie.sjtu.edu.cn/?s=%E4 ... 0%8F%78%72%66%6C%6D
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%6C%65%75%63%64
http://www.ie.sjtu.edu.cn/?s=%E7 ... F%64%73%67%72%6F%6D
http://www.ie.sjtu.edu.cn/?s=%E5 ... 4%6A%72%62%69%79%6C
http://www.ie.sjtu.edu.cn/?s=%E8 ... C%65%62%79%79%6C%68
http://www.ie.sjtu.edu.cn/?s=%E6 ... 7%69%72%6B%69%76%61
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%79%64%64%73%65%69
http://www.ie.sjtu.edu.cn/?s=%E6 ... D%6C%75%63%67%66%7A
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%61%79%71%6F%76%6E
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%66%70%79%66%76
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%70%65%6E%6C%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%77%74%62%78%73%77
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%64%66%63%62%64%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%66%72%6C%71%79
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%8F%68%75%61%6E%64
http://www.ie.sjtu.edu.cn/?s=%E6 ... 5%72%70%72%70%6B%76
http://www.ie.sjtu.edu.cn/?s=%E9 ... 9%64%74%71%74%63%6F
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%6A%72%76%70%77%74

0 回复 有任何疑惑可以回复我~

举报

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

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

进入课程

为什么这样得到答案那么奇怪,怎么不是57.2

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