How To Draw a Hut in C Graphics

Program :

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
  int gd=0,gm;
    initgraph(&gd,&gm,"C://TC//BGI");
int a[]={150,100,180,150,120,150}; //triangle on hut gate
 setfillstyle(1,BROWN);
 fillpoly(3,a);
 int b[]={150,100,300,100,330,150,180,150};  //roof of hut
  setfillstyle(4,RED);
 fillpoly(4,b);
  setfillstyle(1,RED);
 bar(120,150,180,300);     //hut gate
  setfillstyle(1,GREEN);
 bar(140,220,160,300);       // small gate
  setfillstyle(1,YELLOW);
 bar(180,150,330,300);      //hut wall
  setfillstyle(3,GREEN);
  bar(230,220,270,260);    //window
 getch();
 }

Output :








For Practical implementation click on the video given below











Comments

Popular posts from this blog

C Graphics Moving CAR Program