0
Is there any way to clear the console using repl.it?
Is there a library im missing or do I have to do this my self? If so, how would I go about doing this.
1 Answer
+ 1
C++ has no standard function to do that, but you can clear the console through a call to the host environment's command processor by using std::system():
https://en.cppreference.com/w/cpp/utility/program/system
However, the command to issue depends on the platform you are compiling for, so you have to detect the OS through the preprocessor and pass the correct parameter accordingly:
https://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor