為什么輸出錯(cuò)誤呢?
#include <stdio.h>
int main()
{
??? int sale=120; //銷(xiāo)售業(yè)績(jī)?yōu)?20萬(wàn)
??? int year=1; //剛剛進(jìn)入公司1年
??? //完善代碼
??? if(sale > 100)
??? {
??????? if(year >= 2)
??????? {
??????? printf("%s\n", "有獎(jiǎng)勵(lì)");
??????? }
??? }
??? else
??? {
??????? printf("%s\n", "很遺憾;期望你再接再厲");
??? }
??? return 0;
}
2018-06-11
同一等級(jí)的if—else不能都執(zhí)行,如果銷(xiāo)售業(yè)績(jī)大于100,時(shí)間不滿兩年,你直接跳到ruturn 0;不執(zhí)行上面任何輸出語(yǔ)句。