Friday, August 16, 2013

using clrscr() in dev cpp

Clearing screen in DEV C++ compiler :

#include<stdlib.h>

int main()
{
system("cls");
}

//Paste the following text in "C:\Dev-Cpp\include\conio.h" of your system

#include<stdio.h>
#include<stdlib.h>
void clrscr()
{
system("cls");
}


//sample code 

//clrscr function clears the screen amd move the cursor to upper left hand corner of screen.
//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;
}
//