Stupid Newb Question

Started by
2 comments, last by dancingman1956 18 years, 7 months ago
Forgive my ignorance. I've looked on some tutorials for C++ and haven't been able to find a simple "use this function" answer. How do I clear the display with a C++ program. I'm just learning to use C++ and have written a Mancala game. It functions, the issue isit refreshes the display by putting the new "board" under the old board and text. I'd like to clear the old displayed information. I seem to remember there beign a command to do this, I just don't recall what it was. Thanks
Advertisement
Standard C++ doesn't have such a function. You can just try to output a sufficient number of new lines or use a platform specific function.
Thanks, I found the system function which allows you to execute a system command. DOS cls clears the screen so system("cls") did the trick. Thanks.
Another system call I find useful is resizing the console window from within the program, so that I'm not stuck with a 80x25 box.

system("mode con cols=100 lines=45");

'con' is 'console'
'cols' is the number of characters wide the console is to be set
'lines' is the number of lines tall the console is (don't use 'rows' - Windows does not use that term)

All this is specific to Windows.

This topic is closed to new replies.

Advertisement