大佬幫忙啊
#include <stdio.h>
int main()
{
??? int score = 7200;
??? //完善一下代碼
??? if(score>=10000)
??? {
??????? printf("鉆石玩家");
??? }
?if(score >=5000 && score<10000)
??? {
??????? printf("白金玩家");???
??? }
??? else if(1000<=score&&score<5000)
??? {
??????? printf("青銅玩家");????
??? }
???? else(score<1000)
??? {
??????? printf("普通玩家");???
??? }
??? return 0;
}
?最后一個else換成if就可以,else和if在這里有什么區(qū)別嗎
2018-09-28
else是不滿足if條件的情況,后面不加括號表達式的。比如第二個,用if的話是大于等于5000小于10000,如果用else if表達式就只用寫大于等于5000就行了(else就表示不滿足上面的if大于等于10000的情況)。你這里的最后一個else是表示不滿足第二個if及其下面的else if(這三個加起來是一個多重if-else結構,第一個if是單獨的一個結構)