Hey guys, I am creating a program that is quite long and requires much user input.
Is there a way to prevent the command prompt from being so long that the user has to scroll up and down just to see the content?
Is there a way to RESET the command prompt while the program is still executing
so that the next statement appears on line 1 of the command prompt instead of line 20?
int main()
{
string response;
cout << "How Are You"? << endl;
cin >> response;
cout << "That is Great" << endl;
cout << "Where are you from" << endl;
cin >> response;
cout << "Oh wow. I would like to go there one day" << endl;
cout << "Have you ever played Chess??" << endl;//Place this on Line1 of Command prompt
cin >> response;
cout << "I LOVE chess :)" << endl;
return 0;
}
If you do reset, then you cannot "just see all content" any more.
Terminals have a size. That many lines they do show simultaneously.
Separately, they have buffer size. That many lines they remember. When buffer is larger than the window, scrolling lets you go back.
Enough output, and the oldest lines will be forgotten, no matter what.
Terminals can be communicated with to perform some operations. The problem is that there are several different terminals and they don't talk the same language. A better, more portable option is to use a library that offers more operations and may communicate with more than one terminal type. ncurses might be such library.