為什么左后一個(gè)else不能加?xùn)|西
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
if(score>10000)? ??
? ? {
? ? ? ? printf("鉆石玩家");
? ? }
else if(score>5000)? ??
? ? {
? ? ? ? printf("白金玩家");? ??
? ? }
else if(score>1000)? ??
? ? {
? ? ? ? printf("青銅玩家");? ? ?
? ? }
else(score<1000)
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
? ? return 0;
}
為什么有下劃線的那句話刪掉,這個(gè)就能運(yùn)行了
2018-07-16
#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("青銅玩家"); ? ??
? ? }
? ? else if(score<1000)
? ? {
? ? ? ? printf("普通玩家"); ? ?
? ? }
? ? return 0;
}
2018-07-01
elser后面本來(lái)就不可以直接帶條件的
2018-06-21
因?yàn)樯厦娴某绦蛞呀?jīng)排除掉了>1000了,所以剩下的就是<1000