基本上我现在所拥有的是:
//generates the menu
void menu(int TL, string title) {
char a;
//menu layout
cout << title << endl;
emptyLine(TL);
centreHeading(TL, "OPTIONS");
emptyLine(TL);
centreText(TL, "(1) PLAY");
centreText(TL, "(2) SET GAME LENGTH");
centreText(TL, "(3) SET ROW LENGTH");
centreText(TL, "(4) PEG SETTINGS");
centreText(TL, "(9) HELP");
centreText(TL, "(0) EXIT GAME");
emptyLine(TL);
cout << "|" << setw(19) << ""; cin >> a; cout << setw(19) << "|" << endl;
}
我明白这一点:
我们怎样才能确保我们看到这一点?:
Notice that the input 6 is still there, but the | is on the same line as the input, circled in red.
我尝试过寻找解决方案,但似乎其他人对如何防止\ n后续的getline(或某种类型)读取\ n字符感兴趣。
感谢您的帮助。