Skip to content
I want to use clear screen function in my c++ code on repl
Profile icon
RishuMishra

As repl provides ubuntu compiler for c++, I don't know how to use clear screen function and which header file will be used for that function. kindly guide me.

You are viewing a single comment. View All
Answered by theangryepicbanana [earned 5 cycles]
View Answer
Profile icon
SPQR

@RishuMishra
https://en.wikipedia.org/wiki/ANSI_escape_code
Outputting certain codes to some terminals (including the one repl.it uses) can do specific things to the terminal depending on the code.
The \033[2J clears the screen and resets the cursor and the \033[0;0H moves the cursor to 0,0 (again)
You can change the 0;0 to Y;X to move the cursor to line Y and column X thus allowing you to overwrite only certain portions of your screen. Handy for games and such.