課程
/后端開發(fā)
/C
/C語言入門
第一個語句是if,第二個語句是eles if,第三個是eles,那繼續(xù)往后呢?
2021-10-25
源自:C語言入門 4-3
正在回答
應該中間都是else if,開頭是if,結尾是else
#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 if(score<1000)
? ? ? ? printf("%s\n","普通玩家");? ??
? ? return 0;
}
在 else if(score<1000)
中也可以這樣
?else?
慕圣4225369
結束了
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
2 回答第一個if語句是什么意思
2 回答第一個是兩個if的條件語句,第二個我直接是&&
2 回答第二個for語句
1 回答for循環(huán)第三個語句
1 回答第三個是else if還是else else if?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2022-02-02
應該中間都是else if,開頭是if,結尾是else
2021-11-29
#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 if(score<1000)
? ? {
? ? ? ? printf("%s\n","普通玩家");? ??
? ? }
? ? return 0;
}
在 else if(score<1000)
? ? {
? ? ? ? printf("%s\n","普通玩家");? ??
? ? }
中也可以這樣
?else?
? ? {
? ? ? ? printf("%s\n","普通玩家");? ??
? ? }
2021-10-25
結束了