Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


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();
Clearing the screen is always an issue for developers, because now and then we want to show the user some useful or important data, which should be highlighted or at least have user's attention. It is important to note that, after clearing the device, we will lose all our drawing, shapes or images. It is useful but be little cautious. This function does not return any value.
/* 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