請問這個哪里有問題
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
? ? if(score>=10000)
? ? {
? ? ? ? printf("%s\n","鉆石玩家");
? ? }
? ? else if(score>=5000&&score<10000)
? ? {
? ? ? ? printf("%s\n","白金玩家");? ??
? ? }
? ? else if(score>=1000&&score<5000)
? ? {
? ? ? ? printf("%s\n","青銅玩家");? ? ?
? ? }
? ? else(score<1000)
? ? {
? ? ? ? printf("%s\n","普通玩家");? ??
? ? }
? ? return 0;
}
2019-05-25
首先,最后一個else后面不需要表達式了,直接跟大括號就行
else
? ? {
? ? ? ? printf("%s\n","普通玩家");? ??
? ? }
其次,printf后面的條件語句不用這么麻煩,第二個條件就是在(score>=10000)運行完,即score<10000的前提下運行的,只需要?else if(score>=5000)就好了。
?else if(score>=5000)
{
? ? ? ? printf("%s\n","白金玩家");? ??
? ? }