Thursday, April 4, 2013

How to Draw House,Tree & Sun with C-Graphics


#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT ,gm;
int p[]={320,150,420,300,250,300,320,150};
initgraph(&gd,&gm,"C:\\TC\\BGI");
cleardevice();


drawpoly(4,p);
setfillstyle(1,YELLOW);

fillellipse(100,100,60,60);
rectangle(400,300,280,400);

line(320,150,520,150);
line(520,150,600,300);
line(580,300,580,400);
line(320,400,580,400);

rectangle(320,350,350,400);
line(335,350,335,400);

rectangle(480,320,520,400);
rectangle(100,350,120,420);

setfillstyle(1,GREEN);

fillellipse(110,320,30,30);
fillellipse(130,360,30,30);
fillellipse(100,360,30,30);

line(360,300,600,300);
line(330,150,430,300);

getch();
closegraph();
}

No comments:

Post a Comment