我正在尝试从命令行获取一行作为输入。我的问题是我没有得到整条线,但它被空间标记了。
因此,如果我输入诸如“我非常喜欢数学”之类的内容,而不是
"you enterend: I like Math a lot"
我得到以下信息:
EDITING MODE: Enter a command
i like Math a lot
you entered i
EDITING MODE: Enter a command
you entered like
EDITING MODE: Enter a command
you entered Math
EDITING MODE: Enter a command
you entered a
EDITING MODE: Enter a command
you entered lot
void enterEditingMode(){
editingMode = TRUE;
static string CMD = "\nEDITING MODE: Enter a command\n";
string input;
while(editingMode == TRUE){
cout << CMD;
cin >> input;
//we assume input is always correct
// here we need to parse the instruction
cout << "you entered " << input <<endl;