cleardevice function of c graphics programming is used to clear the screen with its background color. It work like a clrscr function in c programming.
General syntax of cleardevice function is:
cleardevice();
General syntax of cleardevice function is:
cleardevice();
C graphics program to demonstrate cleardevice function
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
initgraph(&gd,&gm,"C:\\tc\\bgi");
setbkcolor(9);
rectangle(200,100,500,300);
outtextxy(200,350,"Press any key to clear screen..");
if(getch())
{
cleardevice();
}
getch();
closegraph();
return 0;
}
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
initgraph(&gd,&gm,"C:\\tc\\bgi");
setbkcolor(9);
rectangle(200,100,500,300);
outtextxy(200,350,"Press any key to clear screen..");
if(getch())
{
cleardevice();
}
getch();
closegraph();
return 0;
}
Download |
---|
0 comments:
Post a Comment