if后邊的表達(dá)式哪里錯(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("青銅玩家"); ? ??
? ? }
? ? else if(score<1000)
? ? {
? ? ? ? printf("普通玩家"); ? ?
? ? }
? ? return 0;
}
2018-01-31
? ? if(score>=10000)//完善一下代碼
? ? {
? ? ? ? printf("%s\n","鉆石玩家");
? ? }????????????????????????????????????????????????????????? \\首先當(dāng)某一條件為真的時(shí)候,則不會(huì)向下執(zhí)行該分支結(jié)構(gòu)的其他語(yǔ)句。
else if(score>=5000&&score<=10000)
? ? {
? ? ? ? printf("%s\n","白金玩家"); ? ?
? ? }???????????????????????????????????????????????????????????
\\如果上面為假,即以滿足score<10000的條件,下面的條件直接寫score>=500即可。
? ? else if(score>=1000&&score<=5000)
? ? {
? ? ? ? printf("%s\n","青銅玩家"); ? ??
? ? }
\\同上
2018-01-17
if(score >= 10000)
? ? {
? ? ? ? printf("鉆石玩家");
? ? }
? ? else if(score >= 5000)
? ? {
? ? ? ? printf("白金玩家");? ??
? ? }
? ? else if(score >= 1000)
? ? {
? ? ? ? printf("青銅玩家");? ? ?
? ? }
? ? else
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
大括號(hào)里面的是語(yǔ)句塊,else 或者else if判斷條件之后執(zhí)行語(yǔ)句塊