I do not think it would work in the Online GBD compiler, but in your own environment, you can do system calls, so you can do
system("clear");
in your own code. It seems like system call is ignored on the online compiler (for good reasons).
Have a look here: https://www.tutorialspoint.com/how-can-i-clear-console-using-cplusplus