24建电徐承航


私信TA

用户名:dotcpp0791334

访问量:54

签 名:

等  级
排  名 16150
经  验 814
参赛次数 0
文章发表 1
年  龄 0
在职情况 学生
学  校 华北科技学院
专  业

  自我简介:

TA的其他文章

#include <stdio.h>

//完成利润计算

int main()

{

    double i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0;

    double profit = 0;

    int money = 0;

    scanf("%d", &money);

    switch ((money - 1) / 100000)

        {  //我为何见大局逆转,因为switch可以穿透

            default:  //第六段大于一百万提成1%

            i6 = (money - 1000000) * 0.01;

            case 9://

            case 8://

            case 7://

            case 6://第五段600000 < *** <= 1000000提成1.5%

                if (money - 1000001 < 0)

                    i5 = (money - 600000) * 0.015;

                else

                    i5 = 6000;


            case 4://

            case 5://第四段400000 < *** <= 600000提成3%

                if (money - 600001 < 0)

                    i4 = (money - 400000) * 0.03;

                else

                    i4 = 6000;

            case 3://

            case 2://第三段200000 < *** <= 400000提成5%

                if (money - 400001 < 0)

                    i3 = (money - 200000) * 0.05;

                else

                    i3 = 10000;

            case 1://第二段100000 < *** <= 200000提成7.5%

                if (money - 200001 < 0)

                    i2 = (money - 100000) * 0.075;

                else

                    i2 = 7500;

            case 0://第一段0 < *** <= 100000提成10%

                if ((money - 100001) < 0)

                    i1 = money / 10;

                else

                    i1 = 10000;

            }

    profit = i1 + i2 + i3 + i4 + i5 + i6;

    printf("%0.0lf", profit);

    return 0;

}


 

0.0分

4 人评分

  评论区

  • «
  • »