Don't use
system ("anything");
. It is non-portable, OS-specific code that if you give it to someone else, will cause a compiler error at best, and a computer crash at worst.
There are a couple of other options that are better.
1: Output a whole bunch of newlines:
|
std::cout << std::string ( 100, '\n' );
|
This will create a bunch of new lines and "hide" your previous outputs.
2: If you have the Curses library, you can use that.
e.g.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <ncurses.h>
int main ()
{
initscr ();
addstr ("Press enter to quit!");
refresh ();
getch ();
endwin ();
return 0;
}
|
You can use that to test and see if you have it. You will need to link to the curses library when compiling:
-lncurses.
I don't advise using system() because it is non-portable and IMO shouldn't even be used.
The command inside the parentheses calls directly on the operating system. So, say if you have a Windows computer, and you write code that has a system() command in it, and you give that code to someone who has a Mac, then it will not work on their computer.
If you're just dinking around on your own, system() is fine, but for any code you're going to give to other people, it is bad.
Good luck!
max