Clear screen 'clrscr() is not a standard function, niether in C or C++. So, using clrscr() is not always give you an answer, and it depends upon the compiler you installed and what library is available too. Some says: include library as: #include <conio.h> , this is also does not help much, and most of the times, it does not work because this library : <conio.h> is not standard library too. So, to use clear screen, you have to use :
#include <iostream> WHICH IS KNOWN IN C++ and system('cls'); as in the following example:
#include <stdio.h>
// #include <conio.h> some compilers
//ask for this library, but in our case, no need.
#include <iostream> // available in C++ standard Library
int main()
{
char x;
for(int j=0; j<=10;j++)
{
printf('Press any key to clear the screen.n');
scanf('%c',&x);
// >>>>>>>>>>>>>>>>> clrscr(); you can not use it in
// some compilers.......>>>>>>>>>><<<<<<
// instead use this one: system('cls');
system('cls');
//clearscrean then leave 3 linsbefore writing vnew things
for(int k=0;k<=3;k++)
printf('n');
for(int i=0; i<=3;i++)
{ // repeat each of the following
// line 4 times
for(int m=65;m<=80 ;m++)
//m=65 is equivalant to character 'A' and so on.....
printf('%c',m); // print m as characters and
// not as decimal
printf('----Look at value of j after each clearscreen YAHIA111%d',j);
printf('n');
}
scanf('%c',&x);
}
return 0;
}
Function Was Not Declared In This Scope
Clrscr and Getch in C - These are predefined functions in conio.h Header file, clrscr function in C are use for clear screen and getch function in C is use for get a character form keyboard. Exit and clrscr not declared in the scope; c lambda functions and parameters; Error: Not declared in scope. XYZ not declared in this scope,expected ';' before X? I keep getting 'not declared in scope' Not declared in this scope, Help! MAXPATHLEN not declared in this scope; Object not declared in this scope(OOP and Header files)? Clrscr Function in C. 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 function in C is always optional but it should be place after variable or function declaration only. Function 'clrscr' (works in Turbo C compiler only) clears the screen and moves the cursor to the upper left-hand corner of the screen. If you are using the GCC compiler, use system function to execute the clear/cls command. C programming code for clrscr. Clrscr is function included in conio.h header. When clrscr function is called in a program everything currently displayed in the console(output of previous.