Draw An Insect



Here we are going to draw an insect using simple c-graphics code.You can easily draw an insect by using basic c-graphics functions.This is very interesting and easy to learn.So go through the following code for drawing an insect in c-graphics:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,"");

ellipse(200,200,0,360,60,45);

setfillstyle(SOLID_FILL,BROWN);

floodfill(200,200,WHITE);

ellipse(170,180,0,360,15,8);

ellipse(170,220,0,360,15,8);

setfillstyle(SOLID_FILL,BLUE);

floodfill(170,220,WHITE);

floodfill(170,180,WHITE);

ellipse(320,200,220,140,100,50);

setfillstyle(LINE_FILL,BROWN);

floodfill(320,200,WHITE);

ellipse(320,136,0,360,20,15);

ellipse(260,145,0,360,20,15);

ellipse(380,145,0,360,20,15);

ellipse(320,264,0,360,20,15);

ellipse(260,255,0,360,20,15);

ellipse(380,255,0,360,20,15);

setfillstyle(SOLID_FILL,BROWN);

floodfill(320,136,WHITE);

floodfill(260,145,WHITE);

floodfill(380,145,WHITE);

floodfill(320,264,WHITE);

floodfill(260,255,WHITE);

floodfill(380,255,WHITE);

getch();

closegraph();

}



Above code is used to draw an insect using C-graphics programming.We can easily draw an insect by using basic c-graphics function 'ellipse'.setfillstyle function is used for filling pattern and floodfill function is used to fill the color.You can learn all these function in our tutorial Graphics in C.The output of the above code will be as follows:



Output

c_graphics