基本上我现在的是这个:
//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;
}
我看到了这个:
我们怎样才能确保我们看到这个呢?:
我试过寻找一个解决方案,但似乎其他人对如何防止\ n字符被后续的getline()或某种类型读取更感兴趣 .
谢谢您的帮助 .