Draw a sketch of chair



Here we are going to use c-graphics functions for drawing a sketch of chair.You can easily learn this by having the basic knowledge about the c-graphics functions.The code to draw a chair in c-grahics is given below:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

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

setbkcolor(WHITE);

setcolor(DARKGRAY);

setlinestyle(0,0,3);

line(200,200,175,225);

line(300,200,275,225);

line(200,200,300,200);

line(175,225,275,225);

setfillstyle(SOLID_FILL,BROWN);

floodfill(200,212,DARKGRAY);

line(200,200,200,150);

line(210,200,210,150);

line(300,200,300,150);

line(290,200,290,150);

line(200,150,300,150);

line(200,100,300,100);

line(195,110,195,140);

line(305,110,305,140);

line(200,150,195,140);

line(200,100,195,110);

line(300,150,305,140);

line(300,100,305,110);

floodfill(210,140,DARKGRAY);

floodfill(205,160,DARKGRAY);

floodfill(295,160,DARKGRAY);

line(175,225,175,300);

line(185,225,185,300);

line(175,300,185,300);

floodfill(177,250,DARKGRAY);

line(275,225,275,300);

line(265,225,265,300);

line(265,300,275,300);

floodfill(268,250,DARKGRAY);

line(200,225,200,275);

line(210,225,210,275);

line(200,275,210,275);

floodfill(205,265,DARKGRAY);

line(300,200,300,275);

line(290,210,290,275);

line(290,275,300,275);

floodfill(295,265,DARKGRAY);

setcolor(3);

settextstyle(4,HORIZ_DIR,3);

outtextxy(100,320,"Draw chair using c-graphics functions");

getch();

closegraph();

}



The above code is used to draw a chair on your output screen.We are using simple line function for drawing a chair.We are filling color by using setfillstyle and floodfill functions.settextstyle and outtextxy functions are used to deal with the text.You can learn all these function in our tutorial Graphics in C.The output of the above program will be as follows:



Output

c_graphics