void Display::getInput(){
cout << endl << endl << "Enter Command: ";
char input[MAX_LENGTH];
cin >> input;
if (input == "start"){
startMenu();
}
我得到這個錯誤,但我不知道爲什麼,因爲我總是能使用此語法比較..當其中一個來自cin時,無法比較兩個字符串。這裏有什麼問題?
Display.cpp:在成員函數「void顯示:: getInput() 「:
Display.cpp:20:16:警告:在 未指定的行爲與字符串文字結果的比較[-Waddress]如果(輸入== 「開始」){
使用'strcmp'代替? – Raindrop7
如果使用'std :: string',這些問題會完全消失 – user463035818