C++ Programming Code Examples
Learn C++ Language
cleardevice() Function in C++ Programming Language
cleardevice() Function in C++
The header file graphics.h contains cleardevice() function. cleardevice() is a function which is used to clear the screen by filling the whole screen with the current background color. It means that cleardevice() function is used to clear the whole screen with the current background color and it also sets the current position to (0,0).
Both clrscr() and cleardevice() functions are used to clear the screen but clrscr() is used in text mode and cleardevice function is used in the graphics mode.
Syntax for cleardevice() Function in C++
#include <graphics.h>
void cleardevice();
/* cleardevice erases (that is, fills with the current background color) the entire graphics screen and moves the CP (current position) to home (0,0). */
#include <graphics.h>
int main()
{
clrscr();
cleardevice();
int flag=44;
setbkcolor(3);
draw();
char m[20];
char a[20][20]={"2xqwer4fgi","trewq9y3ry","yuip7qtgfm","jpiuy9bph6","klkjh6decc",
"etlhjklo2k","lasdfapl4z","efghjv5qy","mmjnhlmt8t","134rfvup5n"};
randomize();
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 8");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nplease this is the last time!!!");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
cout<<a[r][i];
td();
cout<<" ";
td();
}
clrscr();
cleardevice();
return 0;
}
Program demonstrates the implementation of Ternary Seach Tree. Create a new ternary search tree node. And insert a new word in a Ternary Search Tree. Search a given word in
This C++ example uses a class that contains a constructor used to 'initialize the object'. The class is called ShoeBox. When supplied with a Length, a Height, a Width, the object should