To run the program we have the include the below header file:
Setting Up the Environment:
- Download the WinBGlm zip file from this link.
- Extract the WinBGlm zip at any desired directory as shown below:
- Copy the header file graphic.h and winbgim.h and paste these file inside the folder Program Files->CodeBlock->MinGW->Include_folder.
- Also copy the libbgi.a and paste inside the folder Program Files->CodeBlock->MinGW-> lib_folder.
- After this open your Code::Blocks and goto the Setting->Compiler->Linker Settings as shown below:
- Add New and Browse the file where the libbgi.a is available which is lib folder.
- And in other linker option paste this: “lbgi lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32“, Click on OK and Exit from Code::Blocks.
Approach: We will create a house with the help of several lines and rectangles. Below are the steps:
- We will draw a line in graphics by passing 4 numbers to line() function as:
line(a, b, c, d)
The above function will draw a line from coordinates (a, b) to (c, d) in the output window.
- IWe will draw a rectangle in graphics by passing 4 numbers to rectangle() function as:
line(left, top, right, bottom)
The above function will draw a rectangle with coordinates of left, right, top and bottom.
- The setfillstyle() function which sets any fill pattern in any shape created in C program using graphics.
- The floodfill() function is used to fill an enclosed area with any color.
Below is the implementation of the above approach:
- How to create a Heart using C Graphics
- Create Directory or Folder with C/C++ Program
- bar() function in C graphics
- Reflection In 2D Graphics
- Mandlebrot Set in C/C++ Using Graphics
- Draw Rectangle in C graphics
- Draw circle in C graphics
- bar3d() function in C graphics
- How to include graphics.h in CodeBlocks?
- Computer Graphics | Antialiasing
- Julia Fractal set in C/C++ Using Graphics
- Introduction to Computer Graphics
- Applications of Computer Graphics
- Draw a line in C++ graphics
- Vector vs Raster Graphics
- Draw ellipse in C graphics
- Sierpinski Triangle using Graphics
- Segments in Computer Graphics
- Translation of objects in computer graphics
- Painter's Algorithm in Computer Graphics
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.