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

Archives

program to print database using moving lights around the boundries

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void getkey(int &ac,int &sc,int&st)
{  REGS m,n;
   m.h.ah=0x00;
   int86(22,&m,&n);
   sc=n.h.ah;
   ac=n.h.al;
   m.h.ah=0x02;
   int86(22,&m,&n);
   st=n.h.al;
}

void main()
{  clrscr();
   REGS m,n;
   int sc,ac,st,d,g,e;
   d=DETECT;
   initgraph(&d,&g,"c:/tc");
   e=graphresult();
   if(e!=0)
   {  cout<<" graphics r not opened";
      getch();
      return;
   }
  setbkcolor(7);
  setcolor(5);
  textbackground(1);
  settextstyle(1, HORIZ_DIR, 4);
  outtextxy(110,60,"STUDENT'S  DATABASE");
  setcolor(6);
  textbackground(6);
  settextstyle(1, HORIZ_DIR, 3);
  outtextxy(150,130,"1)  Insert new record");
  outtextxy(150,160,"2)  Show all record");
  outtextxy(150,190,"3)  Search a record");
  outtextxy(150,220,"4)  Delete a record");
  outtextxy(150,250,"5)  Modify a record");
  outtextxy(150,280,"6)  Exit");
  setcolor(1);
  for(int k=0;k<15;k++)
  {
   //   PRINT  FIRST ROUND LOOP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   setcolor(1);
  int j=-15;
  for(int i=0;i<14;i++)
  {  j-=15;
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,1);
     floodfill(j,15,1);
     circle(j+=15,465,5); //lower horizontal
     setfillstyle(1,1);
     floodfill(j,465,1);
     if(j<=435)                //verticals
     {   circle(630,j,5);
     setfillstyle(1,1);
     floodfill(630,j,1);
     }
     if(j<=390)
     {
     circle(15,j+45,5);
     setfillstyle(1,1);
     floodfill(15,j+45,1);
     }
  }
  delay(75);

  // WASH FIRST ROUND LOOP  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   setcolor(7);
   j=-15;
  for( i=0;i<14;i++)
  {  j-=15;
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,7);
     floodfill(j,15,7);
     circle(j+=15,465,5); //lower horizontal
     setfillstyle(1,7);
     floodfill(j,465,7);
     if(j<=435)                //verticals
     {   circle(630,j,5);
     setfillstyle(1,7);
     floodfill(630,j,7);
     }
     if(j<=390)
     {
     circle(15,j+45,5);
     setfillstyle(1,7);
     floodfill(15,j+45,7);
     }
  }
 //PRINT SECOND ROUND LOOP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  setcolor(1);
  j=-30;
  for( i=0;i<14;i++)
  {  j+=15;
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,1);
     floodfill(j,15,1);
     circle(j-=15,465,5); //lower horizontal
     setfillstyle(1,1);
     floodfill(j,465,1);
     if(j<=420)            //verticals front
     {   circle(15,j+45,5);
     setfillstyle(1,1);
     floodfill(15,j+45,1);
     circle(630,j+30,5);   // back vertical
     setfillstyle(1,1);
     floodfill(630,j+30,1);
     }
  }
   delay(75);
   //WASH SECOND LOOP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   setcolor(7);
  j=-30;
  for( i=0;i<14;i++)
  {  j+=15;
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,7);
     floodfill(j,15,7);
     circle(j-=15,465,5); //lower horizontal
     setfillstyle(1,7);
     floodfill(j,465,7);
      if(j<=420)            //verticals front
     {   circle(15,j+45,5);
     setfillstyle(1,7);
     floodfill(15,j+45,7);
     circle(630,j+30,5);   // back vertical
     setfillstyle(1,7);
     floodfill(630,j+30,7);
     }
  }
   // PRINT THIRD LOOP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   setcolor(1);
  j=0;
  for( i=0;i<14;i++)
  {
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,1);
     floodfill(j,15,1);
     circle(j,465,5); //lower horizontal
     setfillstyle(1,1);
     floodfill(j,465,1);
     if(j<=450)            //verticals
     {   circle(630,j+15,5);
     setfillstyle(1,1);
     floodfill(630,j+15,1);
     }
     if(j<=450)
     {
     circle(15,j,5);
     setfillstyle(1,1);
     floodfill(15,j,1);
     }
   }
   delay(75);
   // WASH THIRD LOOP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   setcolor(7);
  j=0;
  for( i=0;i<14;i++)
  {
     circle(j+=45,15,5);  //upper horizontal
     setfillstyle(1,7);
     floodfill(j,15,7);
     circle(j,465,5); //lower horizontal
     setfillstyle(1,7);
     floodfill(j,465,7);
     if(j<=450)            //verticals
     {   circle(630,j+15,5);
     setfillstyle(1,7);
     floodfill(630,j+15,7);
     }
     if(j<=450)
     {
     circle(15,j,5);
     setfillstyle(1,7);
     floodfill(15,j,7);
     }

   }
 }
  /* m.h.ah=0x00;
   int86(22,&m,&n);
   sc=n.h.ah;
   ac=n.h.al;
   m.h.ah=0x02;
   int86(22,&m,&n);
   st=n.h.al;
   while(1)
   {
       setcolor(9);
       rectangle(150,130,400,160);
       setfillstyle(1,9);
       floodfill(155,140,9);
       setcolor(6);
       settextstyle(1, HORIZ_DIR, 3);
       outtextxy(150,130,"1)  Insert new record");
       if(sc==28)
       getch();
       break;

       if(sc==77||sc==80)
       {     setcolor(6);
         rectangle(150,130,400,160);
         setfillstyle(1,7);
         floodfill(155,140,6);
         setcolor(9);
         rectangle(150,160,400,160);
         setfillstyle(1,9);
         floodfill(155,140,9);
         setcolor(6);
          outtextxy(150,160,"2)  Show all record");
          getch();
       }
   }*/
  getch();
  closegraph();
}

0 comments: