Pages

clrscr() Function in C/C++ Language

Function Name: clrscr()                           
Function Header: <CONIO.H>
Declaration:  void clrscr(void);
Return ValueNone

Notes

This function performs to clear text mode window. It clears the current text window and places the cursor in the upper left-hand corner (at position 1, 1). If we don’t use this function we’ll see the previous output window written any text. 

Example

#include<stdio.h>
#include <conio.h>

 {
     int i;
    clrscr();
    for( i = 0; i < 10; i++)
    printf("clrscr function test\n");
    printf("\n\nPress any key to clear screen");
    getch();

    clrscr();
    printf("The screen has been cleared!");
    getch();
 }

Output




When we press any key, we’ll find the flowing 

 Output





No comments: