【发布时间】:2018-12-26 20:20:53
【问题描述】:
我想知道如何在控制台中进行多项选择提示,您可以在其中使用箭头键选择选项。所以不要像这样:
#include <iostream>
#include <string>
int main()
{
std::string selection;
std::cout << "A. option 1";
std::cout << "B. option 2";
std::cin >> selection;
if(selection == "A") {
//do whatever;
} else if(selection == "B") {
//do something else;
} else {
//repeat the prompt
}
return 0;
}
我可以有一些看起来像这样的东西,但没有花哨的 UI: image
【问题讨论】:
-
好吧,我不认为你可以用
cin或任何标准的东西。这个“花哨的 UI”似乎是 ncurses;您可以将它用于您的程序。 -
是的,从图片上看是ncurses。您不想自己基于
iostream设施以可移植的方式实现这些东西。
标签: c++