為什么最后if是對(duì)的 而else是錯(cuò)的呢?
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? if(score>=10000)
? ? //完善一下代碼
? ??
? ? {
? ? ? ? printf("鉆石玩家");
? ? ? ??
? ? }
? ??
? ? else if(score>=5000&&score<10000)
? ??
? ? {
? ? ? ? printf("白金玩家");? ??
? ? }
? ? else if(score>=1000&&score<5000)
? ? {
? ? ? ? printf("青銅玩家");? ? ?
? ? }
? if(score<1000)? //else(score<1000)是錯(cuò)的 為什么?
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
? ? return 0;
}
2020-03-29
else后面不寫條件,else在條件語句的最后,是因?yàn)槠淠J(rèn)的條件是排除else之前條件所剩的條件。要不就else if。
2020-02-27
最后那個(gè)else后面不跟括號(hào),只寫個(gè)else就行了
2020-02-26
直接用else啊。沒有else()這種說法。
2020-02-25
應(yīng)該是else if吧