0

How can I clear screen when user input something ? In c++

Clear screen

20th Jul 2019, 6:29 PM
The unknown 321
The unknown 321 - avatar
4 Respuestas
+ 1
There are two ways: system("cls"); Or: #include <windows.h> void ClearScreen() { COORD cursorPosition; cursorPosition.X = 0; cursorPosition.Y = 0; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cursorPosition); } The second way is much better than the first.
20th Jul 2019, 6:51 PM
B K
+ 1
When you use system("cls"); in for loop, for example in console snake game, the console will flashing which is irritating. But if you use the second way, there won't be any flashing. On the other hand, if you use first or second method out side the loop, there won't be any difference.
20th Jul 2019, 7:57 PM
B K
0
What's the difference ?
20th Jul 2019, 7:22 PM
The unknown 321
The unknown 321 - avatar
0
Oh ok thanks for the tip. I don't why sololearn don't have these things
21st Jul 2019, 3:51 AM
The unknown 321
The unknown 321 - avatar