4 回答

TA貢獻(xiàn)883條經(jīng)驗(yàn) 獲得超454個(gè)贊
char?x?=?'\0'; cin?>>?x; if?(x?==?'1') ????cout?<<?"szutic"?<<?endl; else ????cout?<<?"你好"?<<?endl;

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
我的vc++6.0只會(huì)報(bào)錯(cuò)誤的數(shù)量不知道在哪錯(cuò)了
這個(gè)是慕課的報(bào)錯(cuò)
error: iostream: No such file or directory
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
In function 'main':
error: 'cin' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: 'cout' undeclared (first use in this function)
error: 'endl' undeclared (first use in this function)
warning: no newline at end of file

TA貢獻(xiàn)883條經(jīng)驗(yàn) 獲得超454個(gè)贊
首先,main函數(shù)應(yīng)該聲明為 int main() ?,不存在返回類(lèi)型為void的聲明。
if語(yǔ)句括號(hào)中最后那個(gè)1是字面常量,不能被寫(xiě)入值

TA貢獻(xiàn)3條經(jīng)驗(yàn) 獲得超0個(gè)贊
既然main函數(shù)是無(wú)返回值 ,那么return 0;就是多余的了。而且cin>>x>>1 這句看不懂
- 4 回答
- 0 關(guān)注
- 2133 瀏覽
添加回答
舉報(bào)