Pages

C GRAPHICS PROGRAM FOR MAN ENTERING CHURCH

Monday, October 17, 2011

Following is c graphics program to display  man entering in to a church on screen. To run this please change the bgi directory.

#include
#include
#include
void main()
{
 int gd,gm,i,j=0;
 gd=DETECT;
 initgraph(&gd,&gm,"c:\\turboc3\\bgi");
 clrscr();
 for(i=0;i<=270;i=i+15)
 {
  cleardevice();
  j++;

  setcolor(11);
  setfillstyle(1,11);
  rectangle(350,200,425,400);         //main wall
  floodfill(351,201,11);
  setcolor(6);
  setfillstyle(1,6);
  rectangle(365,225,410,400);         //door
  floodfill(366,226,6);
  setcolor(7);
  setfillstyle(1,7);
  rectangle(425,250,600,400);         //side wall
  floodfill(426,251,7);
  rectangle(382,200,393,100);         //vertical bar of cross
  rectangle(370,127,405,138);         //horizontal bar of cross
  if(j%2!=0)
  {
   setcolor(15);
   setfillstyle(1,0);
   ellipse(100+i,260,0,360,10,17);        //man head
   fillellipse(100+i,260,10,17);
   line(100+i,277,100+i,330);               //man body
   line(100+i,330,75+i,360);                //man left leg
   line(100+i,330,125+i,360);               //man right leg
   line(80+i,295,120+i,295);                //man hands
  }
  else
  {
   setcolor(15);
   ellipse(100+i,260,0,360,10,17);        //man head
   line(100+i,277,100+i,330);               //man body
   line(100+i,330,95+i,360);                //man left leg
   line(100+i,330,105+i,360);               //man right leg
   line(80+i,295,120+i,295);                //man hands
  }
  sleep(1);
 }
 cleardevice();

  setcolor(11);
  setfillstyle(1,11);
  rectangle(350,200,425,400);         //main wall
  floodfill(351,201,11);
  setcolor(6);
  setfillstyle(1,6);
  rectangle(365,225,410,400);         //door
  floodfill(366,226,6);
  setcolor(7);
  setfillstyle(1,7);
  rectangle(425,250,600,400);         //side wall
  floodfill(426,251,7);
  rectangle(382,200,393,100);         //vertical bar of cross
  rectangle(370,127,405,138);         //horizontal bar of cross
 getch();

}

OUTPUT

No comments:

 

Most Reading