C Program to Draw colored smiley Using C Graphics

In this article, we will create a C program to draw colored smiley using C graphics. It is a crucial question that is asked in exams and is particularly essential for students studying computer graphics.

Before we create the C Program to Draw colored smiley Using C Graphics, we need to cover the concepts that underpin this program. We’ll start with an overview of C graphics and then proceed to discuss how to use these graphics in a C program.

We’ll create a C Program to Draw colored smiley Using C Graphics in this tutorial. It’s a crucial question asked in examinations and is particularly essential for students studying computer graphics. Before creating the C Program to Draw colored smiley Using C Graphics, we’ll learn about the concepts that underpin this program. Let’s go through the fundamentals of C programming and graphics, which will be used throughout this lesson.

C Program to Draw colored smiley Using C Graphics

1. Concepts

In this example, we’ll be using the concepts listed above to create a simple program that draws smiley faces of different colors. To do this, we need to open your favorite code editor and then create a new C program.

  1. fillellipse
  2. ellipse
  3. circle
  4. setcolor
  5. setfillstyle
  6. floodfill

After studying these concepts, you should be able to understand the following c program.

2. C Program to Draw colored smiley Using C Graphics

The C Program to Draw colored smiley Using C Graphics is given below:

#include <conio.h>
 
#include <dos.h>
 
#include <graphics.h>
 
#include <stdio.h>
 
int main() {
  int gr = DETECT, gm;
  initgraph( & gr, & gm, "C:\\Turboc3\\BGI");
  setcolor(YELLOW);
  circle(300, 100, 40);
  setfillstyle(SOLID_FILL, YELLOW);
  floodfill(300, 100, YELLOW);
  setcolor(BLACK);
  setfillstyle(SOLID_FILL, BLACK);
  fillellipse(310, 85, 2, 6);
  fillellipse(290, 85, 2, 6);
  ellipse(300, 100, 205, 335, 20, 9);
  ellipse(300, 100, 205, 335, 20, 10);
  ellipse(300, 100, 205, 335, 20, 11);
  getch();
  closegraph();
  return 0;
}

3. Output

The Output of C Program to Draw colored smiley Using C Graphics

4. Resources

Here are the C Program files and other resources related to this program. Have a look:

groot
groot

Leave a Reply

Your email address will not be published. Required fields are marked *