為什么我運行失敗還是顯示正確(就是讓我做下一節)
index.cpp:?In?function?'int?main()': index.cpp:27:15:?error:?'x'?was?not?declared?in?this?scope ?????????cout<
index.cpp:?In?function?'int?main()': index.cpp:27:15:?error:?'x'?was?not?declared?in?this?scope ?????????cout<
2018-07-12
舉報
2018-07-12
index.cpp: In function 'int main()':
index.cpp:27:17: error: 'x' was not declared in this scope
???????? cout << x <endl;
試了半天才找到你的錯誤。
這里輸出應該是這樣的
?cout << "變量x是奇數" <<endl;
要記得打雙引號,在主函數中沒有定義x這個變量的。如果你想用x的話,要用這個格式
myNum::x;