clrscr function clears the screen amd move the cursor to upper left hand corner of screen.

C programming code for Clrscr


#include
#include


main()
{
printf("Press any key to clear the screen.\n");


getch();


clrscr();


printf("This appears after clearing the screen.\n");
printf("Press any key to exit...\n");


getch();
return 0;
}

In the above program first we display the message "Press any key to clear the screen." using printf and then ask the user to press a key. When user will press a key screen will be cleared and another message will be printed. clrscr function does not work in Dev C++ compiler. Also do not use clrscr in graphics mode instead use cleardevice.


Posted By:-Cplusplusprogramming
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates