In C/C++ there is graphics.h header file which is used to create the object like line, circle, etc.
Given an array arr of N integers, the task is to write C++ program to create the Tree using graphics.h.
Approach: To run the program we have the include the below header file:
We will create a Tree with the help below functions:
- setcolor(color): This function present in graphic.h header file which is used to set the current drawing color to the new color.
- floodfill(pattern, color): function is used to fill an enclosed area. The current fill pattern and fill color is used to fill the area.
- circle(x, y, radius): The header file graphics.h contains circle() function which draws a circle with center at (x, y) and given radius.
- outtextxy(): The header file graphics.h contains outtextxy() function which displays the text or string at a specified point (x, y) on the screen.
Below is the implementation of to draw Tree using graphics in C++: