clrscr function clears the screen amd move the cursor to upper left hand corner of screen.
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.
C programming code for clrscr
#include<stdio.h> #include<conio.h> 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; }
No comments:
Post a Comment