My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

program of digital switches

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
int aaa=80,bbb=150;

void buttan(int,int,int,int);
void circl(int,int,int);
void main()
{         int d,mm,e,a,b,c,k;
      d=DETECT;
      initgraph(&d,&mm,"c:/tc");
      e=graphresult();

      if(e!=0)
      {
          cout<<"Graphics not inialised";
          getch();
          return;
       }

       setbkcolor(BLUE);

       for(int ii=0;ii<4;ii++)
       {
          buttan(aaa,bbb,15,8);
          circl(aaa+30,bbb+50,1);
          aaa+=138;

       }
       aaa=80;
       bbb=150;
    REGS n,m;
    n.x.ax=0;
    int86(0x33,&n,&m);
    k=m.x.ax;
    if(k==0)
    return;
    int aa,bb,t1,t2,p=0;
    while(!kbhit())
    {  n.x.ax=1;
       int86(0x33,&n,&m);
       n.x.ax=3;
       int86(0x33,&n,&m);
       a=m.x.cx;
       b=m.x.dx;
       c=m.x.bx;
       if(c==1 && a>aaa && a<(aaa+58) && b>bbb && b<(bbb+33))
       {
      buttan(aaa,bbb,8,15);
      delay(200);
      circl((aaa+30),(bbb+50),1);
      buttan(aaa,bbb,15,8);
      continue;
       }
       if(c==1 && a>(aaa+138) && a<(aaa+196) && b>bbb&&b<(bbb+33))
       {
       buttan((aaa+138),bbb,8,15);
       delay(200);
       circl((aaa+168),(bbb+50),4);
       buttan((aaa+138),bbb,15,8);
       continue;
       }
     }
 getch();
closegraph();
}

       void buttan(int x, int y,int ltcolor,int rtcolor)
       {

           setcolor(7);
           rectangle(x,y,x+50,y+25);
           setfillstyle(1,7);
           floodfill(x+2,y+2,7);

           setcolor(ltcolor);
           int a[]={ x-4,y-4,x+54,y-4,x+50,y,x,y,x,y+25,x-4,y+29,x-4,y-4};
           drawpoly(7,a);
           setfillstyle(1,ltcolor);
           floodfill(x-3,y-3,ltcolor);

           setcolor(rtcolor);
           int b[]={x+54,y-4,x+54,y+29,x-4,y+29,x,y+25,x+50,y+25,x+50,y,x+54,y-4};
           drawpoly(7,b);
           setfillstyle(1,rtcolor);
           floodfill(x+52,y+10,rtcolor);

           setcolor(1);
           outtextxy(x+13,y+10,"J&U");
        }

        void circl(int xx,int yy,int zz)
        {
           setcolor(RED);
           circle(xx,yy,10);
           setfillstyle(1,zz);
           floodfill(xx,yy,RED);
        }

0 comments: