"Source code of LIFT program"

output will show to click the:   

youtu.be/jJ8JWR1pWBI

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
clrscr();

      int gd=DETECT,gm,i;
      initgraph(&gd,&gm,"c:tcbgi");
      settextstyle(GOTHIC_FONT, HORIZ_DIR, 5);
      outtextxy(140,400,"Made by Rahul");
      setcolor(7);
    //  setbkcolor(1);
      for(i=0; i<12; i++)
      {
line(10,10+32*i,600,10+32*i);
gotoxy(17,2*i+2);
printf("%d",12-i);

      }
 for(i=0; i<12; i++)
      {

gotoxy(32,2*i+2);
printf("%d",12-i);

      }
for(i=0; i<12; i++)
      {

gotoxy(47,2*i+2);
printf("%d",12-i);

      }
for(i=0; i<12; i++)
      {

gotoxy(62,2*i+2);
printf("%d",12-i);

      }
      setcolor(3);
      for(i=0; i<4; i++)
      {
      line(120+i*120,10,120+i*120,400);
      line(150+i*120,10,150+i*120,400);
      }
      int y=80;
      for(i=0; i<8; i++)
      {
      setcolor(4);
if(i%2==0)
y =y+80;

     else
     y=y+40;
     line(y,10,y,400);
      }
      setcolor(2);
      settextstyle(SMALL_FONT, HORIZ_DIR, 0);
      for(i=0; i<4; i++)
      {
      rectangle(165+120*(i),392,195+120*(i),370);
      outtextxy(168+120*i,375,"LIFT");
      }

      int x=0,z,l,l1=1,l2=1,l3=1,l4=1, t1=0,t2=0,t3=0,t4=0,small=12;
      while(x<13){
     gotoxy(2,2);
      scanf("%d",&x);
      t1=x-l1;
      t2=x-l2;
      t3=x-l3;
      t4=x-l4;
      if(t1<0)
      t1=t1*(-1);
      if(t2<0)
      t2=t2*(-1);
      if(t3<0)
      t3=t3*(-1);
      if(t4<0)
      t4=t4*(-1);
      small=12;
if(small>=t1)
{
small=t1;
z=1;
}
if(small>=t2)
{
small=t2;
z=2;
}
if(small>=t3)
{
small=t3;
z=3;
}
if(small>=t4)
{
small=t4;
z=4;
}


      if(x<1||x>14)
x=1;

setcolor(0);

   i=z-1;
   rectangle(125+120*i,388-(l1-1)*32,145+120*i,366-(l1-1)*32);
   rectangle(125+120*i,388-(l2-1)*32,145+120*i,366-(l2-1)*32);
   rectangle(125+120*i,388-(l3-1)*32,145+120*i,366-(l3-1)*32);
 rectangle(125+120*i,388-(l4-1)*32,145+120*i,366-(l4-1)*32);
 setcolor(YELLOW);
   rectangle(125+120*i,388-(x-1)*32,145+120*i,366-(x-1)*32);

      switch(z)
{
      case 1:
 l=l1;
 l1=x;
 break;
      case 2:
      l=l2;
l2=x;
break;
      case 3:
      l=l3;
l3=x;
break;
      case 4:
      l=l4;
l4=x;
break;

 }




     if(x>l)
 {
      for(i=l-1;i<x-1;i++)
      {
      sound(i*100+3000);
      delay(50);
      nosound();
       setcolor(0);
       rectangle(165+120*(z-1),392-i*32,195+120*(z-1),370-i*32);
       outtextxy(168+120*(z-1),375-32*i,"LIFT");
       setcolor(2);
       rectangle(165+120*(z-1),360-32*i,195+120*(z-1),338-32*i);
       outtextxy(168+120*(z-1),375-32*(i+1),"LIFT");
      delay(500);
  }
      sound(i*100);
      delay(200);
      nosound();

     }
  else
   {
      for(i=l; i>x-1;i--)
      {
   sound(i*100+3000);
      delay(50);
      nosound();
      setcolor(0);
       rectangle(165+120*(z-1),392-i*32,195+120*(z-1),370-i*32);
       outtextxy(168+120*(z-1),375-32*i,"LIFT");
      setcolor(2);
      rectangle(165+120*(z-1),424-32*i,195+120*(z-1),402-32*i);
      outtextxy(168+120*(z-1),375-32*(i-1),"LIFT");
      delay(500);
  }

   sound(i*100);
      delay(200);
      nosound();
      }
      }
      getch();
}
 
 

 
Today, there have been 3147 visitors (5965 hits) on this page!
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free