if 語(yǔ)句怎么嵌套啊,多個(gè)選擇怎么辦
if 語(yǔ)句怎么嵌套啊,多個(gè)選擇怎么辦
例如:
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
? ??
? ? {
? ? ? ? if(score>=10000)
? ? ? ? printf("鉆石玩家");
? ? }
? ??
? ? {
? ? ? ? else (score>=5000&&score<10000)
? ? ? ? printf("白金玩家"); ? ?
? ? }
? ??
? ? {
? ? ? ? else if(score>=1000&&score<5000)
? ? ? ? printf("青銅玩家"); ? ??
? ? }
??
? ? {
? ? ? ? else (score<1000)
? ? ? ? printf("普通玩家"); ? ?
? ? }
? ? return 0;
}
2017-03-14
有點(diǎn)看不懂你的問(wèn)題,但是你想看if語(yǔ)句怎么嵌套,我給你發(fā)個(gè)代碼
#include <stdio.h>
int main()
{
??? int sale = 120;
??? int year = 1;
??? if(sale >= 100)
??? {
??????? if(year >= 2)
??????? {
??????????? printf("小明有資格獲得獎(jiǎng)勵(lì)\n");
??????? }
??????? else
??????? {
??????????? printf("很遺憾,期望你再接再厲\n");
??????? }
??? }
??? else
??? {
??????? printf("滾蛋\n");
??? }
??? return 0;
}