+ 14
How do I clear screen in my c++ program?
Trying to create a tic tac toe game , needs the outdated clrscr() function in conio.h in standard version
4 ответов
+ 10
Here's what I use. It's not the perfect solution, but it does the job:
void clear() {
#ifdef _WIN32
system("cls");
#else
std::cout << "\033[2J\033[1;1H";
#endif
}
If you're curious why this works, see: https://en.wikipedia.org/wiki/ANSI_escape_code
+ 13
If you're trying to clear console screen on C.Playground, I don't think there's a way, because it doesn't actually work like a desktop console. clrscr() is not working for me on desktop either, so I go for system("CLS"), but I believe that isn't a good practice either.
One nasty way is to do multiple newlines using a loop to push previous output out of console display range.
for (int i = 0; i < 39; i++, std::cout << "\n");
+ 13
You may use system("cls") on a Windows Platform, or system("clear") on Linux - Based Consoles...
system("clear") works on Android apps like CppDroid as well...
0
Guys, I need answer about this...
How to use system("CLS") in cppdroid.
I using cppdroid in android device.
hoping I can solve this..