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 a line

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
int a,b,c,k;
void main()
{   clrscr();
    int d,mm,e;
    d=DETECT;
    initgraph(&d,&mm,"c:/tc");
    e=graphresult();
    if(e!=0)
    {  cout<<" graphics r not opened";
       getch();
       return;
    }
    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)
       {   if(p==0)
       {  aa=a;
          bb=b;
          p++;
       }
       if(t1!=a||t2!=b)
       {  setcolor(0);
          line(aa,bb,t1,t2);
        //  cleardevice();
       }
       setcolor(5);
       line(aa,bb,a,b);
       t1=a;
       t2=b;
       }
       else
       p=0;
   }
    getch();
    closegraph();
 }

0 comments: