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