C program to draw a circle and ellipses

Complete C program to draw a circle and ellipses

void main() 
int gd=DETECT; 
int gm; 
Initgraph (&gd,&gm,””); 
Circle (getmaxx ()/2,getmaxy ()/2,100); /*draws a circle taking midpoint of 
the screen as center co-ordinates and 
100 as radius */ 
setcolor(2); /*sets the drawing color as green */ 
/* draws an ellipse taking center of the screen as its center , 0 as starting angle 
and 360 as ending angle and 80 pixel as Y radius */
setcolor(4); /*sets the drawing color as red */ 
ellipse(getmaxx()/2, getmaxy()/2,90,270,50, 80); 
/*draws half the ellipse starting from 90 angle and ending at 27o angle 
with 50 pixels as X-radius and 80 pixels as Y-radius in red color */ 
closegraph(); /* closes the graph mode */ 

Leave a Comment