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

我这是哪错了啊

#include <stdio.h>
double money(float dis,float ofhour)
{
    float money;
    if(dis<=3)
    {
        money=14;
    }
    else if(dis>3)
    {
        if(ofhour>=5&&ofhour<23)
        {
            money=(dis-3)*2.3+14;
        }
        else if
        { 
            money=(dis-3)*2.3*(1+0.2)+14;
        }
    }
    return money;
}
int main()
{
    printf("小明打车费用为%.1f\n",texifee(12,9)+texifee(12,6));
    return 0;
}

正在回答

2 回答

#include<stdio.h>

double getMoney(int dis,int hours)

{

double totalMoney=0.00;

double per=2.30;

double sta=13.00;

if(hours<0||hours>24)

{

printf("请输入正确的数字:");

return 0;

}

else if(!(hours>=5&&hours<23))

{

per*=1.2;

}

if(dis<=3)

{

totalMoney=sta;

}

else

{

totalMoney=sta+(dis-3)*per;

}

totalMoney++;

return totalMoney;

}

int main()

{

double totalMoney=0.00;

int mor=9;

int aft=18;

int dis=12;

double per=2.30;

totalMoney=getMoney(dis,mor)+getMoney(dis,aft);

printf("小明的搭车费用为:%.2f\n",totalMoney);

return 0;

}


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

#include <stdio.h>

double money(float dis,float ofhour)

{

    float money;

    if(dis<=3)

    {

        money=14;

    }

    else if(dis>3)

    {

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

        {

            money=(dis-3)*2.3+14;

        }

        else

        {  

            money=(dis-3)*2.3*(1+0.2)+14;

        }

    }

    return money;

}

int main()

{

    printf("小明打车费用为%.1f\n",texifee(12,9)+texifee(12,6));

    return 0;

}

  把if  那段代码里面的if删除一个   还有 你输出里面的texifee  是没给出? 

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

举报

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

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

进入课程

我这是哪错了啊

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