Please tell me about clrscr in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Please tell me about clrscr in c++

15th May 2018, 2:20 PM
Mahendra Kumar
Mahendra Kumar - avatar
3 Answers
+ 27
It is a predefined function, by using this function we can clear the data from console . Use of clrscr() is always optional but it should be place after variable or function declaration only.
15th May 2018, 2:56 PM
Anisha
Anisha - avatar
+ 1
"It is a predefined function in "conio.h" (console input output header file) used to clear the console screen. It is a predefined function, by using this function we can clear the data from console (Monitor). Using of clrscr() is always optional but it should be place after variable or function declaration only." example: #include<iostream.h> #include<conio.h> void main() { int a=10, b=20; int sum=0; clrscr(); // use clrscr() after variable declaration sum=a+b; cout<<"Sum: "<<sum; } according to sitesbay.com https://www.sitesbay.com/cpp/cpp-clrscr()-and-getch()
15th May 2018, 2:58 PM
Jack
Jack - avatar
+ 1
clrscr() is used to clear command window before executing the current code in the window
15th May 2018, 5:35 PM
Sandeep Satheesan
Sandeep Satheesan - avatar