課程
/后端開發(fā)
/C
/C語言入門
當(dāng)在寫解集1>x>2時(shí),在c語中能不能寫為x>1,x<2
2021-07-04
源自:C語言入門 4-3
正在回答
那你得用計(jì)算機(jī)語言的&& 不然你這個(gè)就是錯(cuò)誤代碼
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
? ? if(score >= 10000)
? ? {
? ? ? ? printf("鉆石玩家");
? ? }
? ? else if(5000 <= score < 10000)
? ? ? ? printf("白金玩家");? ??
? ? else if(1000 <= score < 5000)
? ? ? ? printf("青銅玩家");? ? ?
? ? else
? ? ? ? printf("普通玩家");? ??
? ? return 0;
}
你可以寫成1<x<2? 這種形式
不能,只能寫成x>1&&x<2,其中&&表示且的意思
舉報(bào)
C語言入門視頻教程,帶你進(jìn)入編程世界的必修課-C語言
4 回答x = x*2為什么不能寫成x *= 2?
1 回答怎么能當(dāng)x=1時(shí)讓y=2x^2+x+8等于11?
1 回答可以寫x=2*x嗎
1 回答int x=0,應(yīng)該是x++=1 ++x=2啊,為什么x++=0
2 回答為什么x=2*x不行呀,只能x=x*2才運(yùn)算得出來
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2021-09-06
那你得用計(jì)算機(jī)語言的&& 不然你這個(gè)就是錯(cuò)誤代碼
2021-08-12
#include <stdio.h>
int main()?
{
? ? int score = 7200;
? ? //完善一下代碼
? ? if(score >= 10000)
? ? {
? ? ? ? printf("鉆石玩家");
? ? }
? ? else if(5000 <= score < 10000)
? ? {
? ? ? ? printf("白金玩家");? ??
? ? }
? ? else if(1000 <= score < 5000)
? ? {
? ? ? ? printf("青銅玩家");? ? ?
? ? }
? ? else
? ? {
? ? ? ? printf("普通玩家");? ??
? ? }
? ? return 0;
}
你可以寫成1<x<2? 這種形式
2021-07-04
不能,只能寫成x>1&&x<2,其中&&表示且的意思