What you are describing is not a "console program" as such, but a shell. In addition, you do not want to handle incoming events, you just want to just read from the command line.
There are various ways to do this. Windows has a ReadConsoleInput . A more flexible way, however, is that this is one of the getline values.
int main () { string mystr; cout << "What your name? "; getline (cin, mystr); return 0; }
To make you special work, you just need to keep the previous entries of std::vector<string> or similar.
To read the original input (without echo) from the console, you should use _ getch ()
source share