求解釋求解釋 沒有錯誤啊 ?????
#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 (score < 1000)
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
? ? return 0;
}
2019-01-12
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
? ? if(score >= 10000)
? ? {
? ? ? ? printf("%s\n","鉆石玩家");
? ? }
? ? else if(score >= 5000)
? ? {
? ? ? ? printf("%s\n","白金玩家"); ? ?
? ? }
? ? else if(score >= 1000)
? ? {
? ? ? ? printf("青銅玩家"); ? ??
? ? }
? ? else
? ? {
? ? ? ? printf("普通玩家"); ? ?
? ? }
? ? return 0;
}
2019-01-03
2018-12-25
#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?
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
? ? return 0;
}
2018-12-24
你前面都是else if,那你最后一個用else就不恰當,也應該改為else if
2018-12-24
錯誤在最后【else (score < 1000)】,要寫條件需要if(/* condition */)。
其實你的代碼【if(score >= 10000){}else if(score >= 5000&&score < 10000)...】,? 用else以后其實已經是滿足score < 10000條件了,完全不用&&score < 10000了,直接else if(score >= 5000)即可,后面幾個條件也是如此。
希望對你有幫助~~~