Draw Circle in C graphics
In this program, You will learn and get the source code to draw circle in c graphics.
Here we will create two colorful circles in computer graphics with setcolor function to set the color of object and circle function to draw the circle.
Program Code to Draw Circle in C Graphics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | //Draw Colorful Circles in Computer Graphics //include the graphics header file #include<graphics.h> #include<stdio.h> #include<conio.h> void main() { //Initialize the variables for the graphics driver and mode int gd = DETECT, gm; clrscr(); initgraph(&gd, &gm, "C:\TURBOC3\BGI"); //Set the color of object. setcolor(BLUE); //drawing a circle using the circle function circle(100,100,40); setcolor(RED); circle(200,100,40); getch(); //unloads graphics driver closegraph(); } |
Output
Make Circle using Different Drawing Algorithms
1. Bresenham Circle Drawing Algorithm
2. MidPoint Circle Drawing Algorithm