Draw a cycle



Here we are going to learn the code for drawing a cycle in c-graphics.This is very easy to learn.This will surely attract your attention towards c-graphics.So go through the following code for drawing cycle in c-graphics:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

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

/*create wheels of cycle*/

circle(200,200,50);

circle(400,200,50);

line(400,150,400,250);

line(350,200,450,200);

line(375,156,425,245);

line(356,180,446,222);

line(370,240,425,158);

line(356,220,444,180);

line(200,150,200,250);

line(150,200,250,200);

line(175,156,225,245);

line(156,180,246,222);

line(170,240,225,158);

line(156,220,244,180);

circle(400,200,3);

circle(200,200,3);

circle(200,200,10);

circle(300,200,15);

line(200,190,300,185);

line(200,210,300,215);

line(300,170,300,230);

/*Draw Paddles*/

line(280,170,300,170);

line(320,230,300,230);

line(200,200,300,200);

line(300,200,220,120);

line(300,200,380,120);

line(220,120,380,120);

line(200,200,220,120);

line(220,120,220,110);

/*Draw Seat*/

circle(220,100,10);

setfillstyle(SOLID_FILL,BLUE);

floodfill(220,100,WHITE);

/*Draw Handle*/

line(400,200,365,50);

ellipse(325,50,280,80,40,40);

arc(200,200,0,180,55);

arc(400,200,80,210,55);

getch();

closegraph();

}



The above code is used to create cycle in c-graphics programming.You can easily create a cycle in c-graphics by using some simple functions like line,circle,arc,ellipse etc.Colors can be fill and set by the floodfill, setfillstyle and setcolor functions.You can study these function in our tutorial Graphics in C.The output of above program is as follows:



Output

c_graphics