我正在编写一个多行系统,如下所示:
string readLines(string x)
{
string temp = "a";
vector<string> lines(0);
string result;
while (1)
{
cout << x;
getline(cin, temp)
if(temp != "")
{
result = result + "\n" + temp;
lines.push_back(temp);
}
else
break;
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
工作正常,但是我希望能够编辑上一行,例如,我正在输入如下内容:
Helo,
World
Run Code Online (Sandbox Code Playgroud)
我想重新helo修复我的错字。我怎样才能做到这一点?