我有一个小问题,不确定是否有可能通过iostream的代码解决,但我认为值得问一下。
#include <iostream>
#include <string>
using namespace std;
string cmd;
int main() {
cout << "-------------" << endl;
cout << "command: ";
cin >> cmd;
cout << "-------------" << endl;
system("pause");
}
用户在输入cmd
变量之前,是否有任何方式可以打印第三个cout
行呢?这样,文本字段将用上下"-"
包装,看起来像这样:
-------------
command: <user would type here>
-------------
如果这不可行,您能否指向一些我可以使用以达到此目的的可能库?