The task is to write a C program to draw a Heart using graphics in C.
Approach: To run the program we have the include the below header file:
We will create a Heart with the help below functions:
- rectangle(x1,y1,x2,y2): A function from graphics.h header file is responsible for creating rectangle on the screen.
- ellipse(x,y,a1,a2,r1,r2): A function from graphics.h header file is responsible for creating ellipse on the screen.
- line(x1,y1,x2,y2): A function from graphics.h header file which draw a line.
- setfillstyle(pattern, color): The header file graphics.h contains setfillstyle() function which sets the current fill pattern and fills 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.
Below is the implementation of to draw Heart using graphics in C:
- C Program to create a House using Graphics
- Printing Heart Pattern in C
- bar() function in C graphics
- Reflection In 2D Graphics
- Mandlebrot Set in C/C++ Using Graphics
- Draw ellipse in C graphics
- Draw a line in C++ graphics
- Computer Graphics | Antialiasing
- bar3d() function in C graphics
- How to include graphics.h in CodeBlocks?
- Introduction to Computer Graphics
- Draw Rectangle in C graphics
- Draw circle in C graphics
- Segments in Computer Graphics
- Applications of Computer Graphics
- Vector vs Raster Graphics
- Sierpinski Triangle using Graphics
- Julia Fractal set in C/C++ Using Graphics
- Interpolation Methods in Computer Graphics
- How to add "graphics.h" C/C++ library to gcc compiler in Linux
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.