第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

if-else 運(yùn)行出錯(cuò)

#include "stdio.h"

#include "math.h"

main()

{

? ? double y,x;

? ? printf("請(qǐng)輸入x的值");

? ? scanf("%f",x);

? ? if(x>=-10&&x<=4)

? ? y=fabs(x-2);

? ? printf("y=%f",y);

? ? else if(x>4&&x<=7)

? ? y=x+10;

? ? printf("y=%f",y);

? ? else if(x>7&&x<12)

? ? y=x*x*x*x;

? ? printf("y=%f",y);

? ? else?

printf("noanswer");

}


正在回答

4 回答

#include "stdio.h"

#include "math.h"

main()

{

? ? double y,x; ? ? ? ?float y,x;

? ? printf("請(qǐng)輸入x的值");

? ? scanf("%f",x); ? ? ? ?scanf("%f",&x);

? ? if(x>=-10&&x<=4)

? ? y=fabs(x-2);

? ? printf("y=%f",y);

? ? else if(x>4&&x<=7)

? ? y=x+10;

? ? printf("y=%f",y);

? ? else if(x>7&&x<12)

? ? y=x*x*x*x;

? ? printf("y=%f",y);

? ? else?

printf("noanswer");

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

主要的問(wèn)題所在是scanf 我忘了加& 而且 double 對(duì)應(yīng)的是 %lf 應(yīng)該是scanf("%ld",&x) 謝謝各位了

0 回復(fù) 有任何疑惑可以回復(fù)我~

if里面是多條語(yǔ)句的時(shí)候要加{}

0 回復(fù) 有任何疑惑可以回復(fù)我~

把if語(yǔ)句和后面的else if語(yǔ)句要執(zhí)行的代碼都用大括號(hào)括起來(lái)試試,你把代碼書(shū)寫(xiě)規(guī)范一些。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
C語(yǔ)言入門(mén)
  • 參與學(xué)習(xí)       926981    人
  • 解答問(wèn)題       21533    個(gè)

C語(yǔ)言入門(mén)視頻教程,帶你進(jìn)入編程世界的必修課-C語(yǔ)言

進(jìn)入課程

if-else 運(yùn)行出錯(cuò)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)