+ 4

How do you clear the screen in modern c++?

I had came up from Turbo C++, which isn't a good compiler to use now, but now I am having problem clearing the screen away! In Turbo, I had used clrscr() function from <conio.h> library and it worked perfectly. However it does not work in modern compilers. Will anyone help me?

25th Dec 2017, 4:00 AM
Naveen Maurya
Naveen Maurya - avatar
6 Answers
+ 4
@Jamie Will 25 '\n' work?
25th Dec 2017, 4:51 AM
Naveen Maurya
Naveen Maurya - avatar
+ 3
@Jamie Thanks!
25th Dec 2017, 4:53 AM
Naveen Maurya
Naveen Maurya - avatar
+ 1
Late but here is something void clearScreen() { #if defined(WIN32) || defined(__WIN32) || defined(__WIN32__) system("cls"); #else system("clear"); #endif }
8th Jul 2019, 4:29 AM
Shahil Ahmed
Shahil Ahmed - avatar