问答详情
源自:5-14 综合练习

5.13课后训练

  →_→→_→   58ce416f0001105b07201280.jpg

提问者:慕粉155617866 2017-03-19 16:30

个回答

  • qq_番茄蛋花汤_0
    2017-03-19 19:34:02
    已采纳

    #include <stdio.h>

    int my_charge(float time,double km);


    int main()

    {

        double cost=0;

        cost=cost+my_charge(9,12);

        cost=cost+my_charge(18,12);

        printf("总费用是:%f",cost); 

        return 0;

        

    }

    int my_charge(float time,double km)

    {

        double danjia=2.3,qibu=13,cost=0;

        if(km<=3)

        {

            cost=14;

        }

        else

        {

            cost=13+(km-3)*2.3+1;

        }

        if ((time>=23&&time<=24)||(time>=0&&time<=6))

        {

            cost=cost*1.2;

        }

        return cost;

    }