Clearing Screen

Hello all. I am having a problem with my c++ code. I am attempting to clear the text off of the command prompt screen in a text based game program. I put a restart option using a goto in my program. How would I be able to clear all previously displayed text.
use a bunch of newlines, and just move the old output out of sight
Could i see an example of using a newline?
std::cout << std::endl;
how about CMD?

system("cls");
http://www.cplusplus.com/articles/4z18T05o/


In a nutshell:
std::cout << std::string(300, '\n') << std::endl;

Do not use system()!
Last edited on
i know system is evil but in his case probably not!
Last edited on
When I used
system("cls");
it did not work, however when I added
#include <cstdlib>
it worked perfectly, thanks!
Topic archived. No new replies allowed.