Create toy-train



Here we are going to teach you to create a new beautiful object.This article will tell you how can you create a toy train by using simple c-graphics functions.To learn to draw toy train in c go through the following code:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

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

line(300,150,300,300);

line(390,150,390,300);

line(290,150,400,150);

line(290,145,400,145);

line(290,145,290,150);

line(400,145,400,150);

line(310,160,380,160);

line(310,210,380,210);

line(310,160,310,210);

line(380,160,380,210);

circle(346,300,22);

circle(346,300,27);

line(300,300,318,300);

line(390,300,375,300);

line(300,225,200,225);

line(200,225,200,300);

line(200,300,215,300);

circle(230,300,15);

circle(230,300,10);

circle(270,300,15);

circle(270,300,10);

line(255,300,245,300);

line(285,300,305,300);

line(215,305,260,305);

line(217,309,262,309);

line(215,305,217,309);

line(260,305,262,309);

line(280,225,280,205);

line(265,225,265,205);

line(265,205,280,205);

ellipse(273,205,0,180,7,6);

line(240,225,240,210);

line(230,225,230,210);

line(240,210,230,210);

ellipse(235,210,0,180,5,4);

line(210,225,210,185);

line(215,225,215,185);

line(210,185,215,185);

line(210,185,190,150);

line(215,185,235,150);

line(190,150,235,150);

line(190,150,200,140);

line(235,150,225,140);

line(200,140,225,140);

getch();

closegraph();

}



In the above code we used the simple circle,ellipse and line functions in order to draw toy train on your screen.You can study these functions in detail from our tutorial Graphics in C.Here is the output of the above code:



Output

c_graphics