What robbitt has said bout the alternate way is really a good logic however the height need not to be 80 rather u can just define it to be 24 as the console has only 25 rows.
Not every console. I just picked 80 as an arbitrary value. Of course, determining the console height is not anything you can do portably, so you may as well go with a function like clrscr() or write so many newlines that it will be sure to clear *any* console.
Regarding aphrodita's comment, the call to system() will work, with the proviso that you need to provide an argument that is the command-line command to clear the screen in your particular OS. DOS/Windows uses "cls", but many Unices use "clear".
If you want portability, you might find it easiest to use the quick-n-dirty method of printing some arbitrary number of newlines.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.