问答详情
源自:4-3 分支结构之多重if-else语句

麻烦您们给小弟看看错在哪里 4-3 分支结构之多重if-else语句

4-3 分支结构之多重if-else语句



提问者:逆水中的鱼 2015-07-27 17:11

个回答

  • TheMoonLight
    2015-07-27 17:28:48
    已采纳

    可爱的小弟呀,你知道{}这个大括号是什么用吗?是用来表示满足if()的条件要执行的语句。所以if,else if应该放在它外面,所以答案是这样的:

    #include <stdio.h>

    int main() 

    {

        int score = 7200;

        //完善一下代码

        if(score>=10000)

        {

            printf("钻石玩家");

        }

        else if(score>=5000&&score<10000)

        {

            printf("白金玩家");    

        }

        else if(score>=1000&&score<10000)

        {

            printf("青铜玩家");     

        }

        else if(score<1000)

        {

            printf("普通玩家");    

        }

        return 0;

    }