over again+deleting old

Hi, just a quick and simple question: How do you vanish the last session of your program when you start over again, i mean, if i choose to run program over again, how to delete all the text with inputs and etc from the program window and make it all clear again?

Last edited on
If I understood correctly you want to clear the contents of the current screen buffer, aka clear the screen?

One way, if you are on windows is like this. This is not a cross-platform, non a very practical way to do this.
1
2
3
void clearScreen(){    
system("CLS");     //needs #include<windows> in order to work
}


The other way to do this, is just to output many new lines.
1
2
3
4
5
void clearScreen(){
for (int i=0; i<100; i++){
cout<<'\n';
}
}

Topic archived. No new replies allowed.