Draw A Tortoise



We can create so many beautiful objects using c-graphics like house,scenery,cycle etc.. etc... Here we are going to create a tortoise using simple c-graphics programming.It is very easy to draw a tortoise in c-graphics.You have to use simple functions of c-graphics in order to draw a tortoise.So go through the following code for drawing tortoise on your computer screen:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

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

setbkcolor(BROWN);

setcolor(DARKGRAY);

ellipse(250,240,0,180,100,150);

line(150,240,350,240);

setfillstyle(SOLID_FILL,LIGHTGREEN);

line(160,240,155,270);

line(180,240,180,272);

line(187,240,187,268);

line(340,240,345,270);

line(320,240,320,272);

line(313,240,313,268);

ellipse(160,269,180,0,4,4);

ellipse(168,269,180,0,4,4);

ellipse(176,269,180,0,4,4);

floodfill(176,269,DARKGRAY);

setfillstyle(SOLID_FILL,GREEN);

ellipse(184,266,180,0,3,3);

floodfill(184,266,DARKGRAY);

setfillstyle(SOLID_FILL,LIGHTGREEN);

ellipse(340,269,180,0,4,4);

ellipse(332,269,180,0,4,4);

ellipse(324,269,180,0,4,4);

floodfill(324,269,DARKGRAY);

setfillstyle(SOLID_FILL,GREEN);

ellipse(316,266,180,0,3,3);

floodfill(316,266,DARKGRAY);

setfillstyle(SOLID_FILL,GREEN);

ellipse(190,200,0,360,30,20);

floodfill(190,200,DARKGRAY);

ellipse(220,150,0,360,20,20);

floodfill(220,150,DARKGRAY);

ellipse(250,180,0,360,15,10);

floodfill(250,180,DARKGRAY);

ellipse(300,150,0,360,10,10);

floodfill(300,150,DARKGRAY);

ellipse(270,120,0,360,20,15);

floodfill(270,120,DARKGRAY);

ellipse(300,210,0,360,30,20);

floodfill(300,210,DARKGRAY);

ellipse(245,215,0,360,15,15);

floodfill(245,215,DARKGRAY);

ellipse(280,170,0,360,5,5);

floodfill(280,170,DARKGRAY);

setfillstyle(SOLID_FILL,LIGHTGREEN);

floodfill(290,180,DARKGRAY);

line(350,237,390,237);

line(390,237,396,220);

ellipse(370,220,0,140,27,20);

setfillstyle(SOLID_FILL,LIGHTGREEN);

floodfill(366,226,DARKGRAY);

circle(385,215,2);

setfillstyle(SOLID_FILL,DARKGRAY);

floodfill(385,215,DARKGRAY);

line(390,237,375,232);

setfillstyle(SOLID_FILL,LIGHTGREEN);

line(150,225,130,240);

line(130,240,150,235);

floodfill(145,235,DARKGRAY);

setcolor(LIGHTGREEN);

settextstyle(1,HORIZ_DIR,7);

outtextxy(140,300,"TORTOISE");

getch();

closegraph();

}



Above code is used to draw a tortoise in c-graphics programming.In this code we are using basic functions of c-graphics like line,ellipse,circle for drawing body parts of tortoise.We are using setfillstyle and floodfill functions for filling the color in tortoise.settextstyle and outtextxy functions are used here for print text on the output screen.You can learn these functions in detail from our tutorial 'Graphics in C'.The output of the above program will be as follows:



Output

c_graphics