To run the program we have the include the below header file:
Approach: We will create a Smiley Face with the help below functions:
- fillellipse(int x, int y, int x_radius, int y_radius): A function from graphics.h header file which draws and fills an ellipse with center at (x, y) and (x_radius, y_radius) as x and y radius of ellipse.
- ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius): A function from graphics.h header file which is used to draw an ellipse (x, y) are coordinates of the center of the ellipse, stangle is the starting angle, end angle is the ending angle, and fifth and sixth parameters specifies the X and Y radius of the ellipse.
- setcolor(n): A function from graphics.h header file which set the color of pointer(cursor).
- setfillstyle(): A function from graphics.h header file which sets the current fill pattern and fill color.
- floodfill(): A function from graphics.h header file which is used to fill an enclosed area.
Below is the implementation of to draw Smiley Face using graphics in C:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Draw a moving car using computer graphics programming in C
- Draw a Chess Board using Graphics Programming in C
- Draw ellipse in C graphics
- Draw a line in C++ graphics
- Draw Rectangle in C graphics
- Draw circle in C graphics
- Draw an Ellipse rotating over a Circle in C++ graphics
- Draw a triangle in C++ graphics
- Back-Face Detection Method
- Creating a Rainbow using Graphics Programming in C
- Sierpinski Triangle using Graphics
- Flood fill algorithm using C graphics
- Creating Butterfly themed Fractal in C++ Using Graphics
- Mandlebrot Set in C/C++ Using Graphics
- How to create a Heart using C Graphics
- C Program to create a House using Graphics
- Represent Tree using graphics in C/C++
- DDA Line generation Algorithm in Computer Graphics
- Point Clipping Algorithm 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.