Console clear in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Console clear in c++

How can i clear console using c++? In C# i used Console.Clear(); But C++ haven't got something like this function.

23rd Jul 2021, 6:23 AM
Annie Lightenko
Annie Lightenko - avatar
1 Answer
+ 1
I found this information, but Sololearn compiler didn't work well as always. So i will check this for truth l8r in VisualStudio. When the screen is cleared in Visual C++, the cursor is moved to the upper left corner of the screen.  To clear the screen in Visual C++, utilize the code:  system("CLS"); The standard library header file <stdlib.h> is needed. Note:  If you wish to clear the screen after a cout statement, you will need to "flush" the iostream.    system ("CLS"); cout<< "Hello"<<flush;  system ("CLS"); cout<< "Good-Bye"<<endl;
23rd Jul 2021, 6:28 AM
Annie Lightenko
Annie Lightenko - avatar