Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- #include<graphics.h>
- void main()
- {
- clrscr();
- int gd=DETECT,gm;
- clrscr();
- initgraph(&gd,&gm,"c:\\tc\\bgi");
- int a[10][10],b[10][10],c[10][10],d[10][10],e[10][10],i;
- cout<< "enter the coordinates of x,y:";
- for(i=0;i<=1;i++)
- cin>>a[i][0];
- cout<<"enter the coordinates of x1,y1:";
- for(i=0;i<=1;i++)
- cin>>b[i][0];
- setcolor(CYAN);
- line(a[0][0],b[0][0],a[1][0],b[1][0]);
- setcolor(WHITE);
- cout<<"\n enter the translation coordinates:";
- for(i=0;i<=1;i++)
- cin>>c[i][0];
- for(i=0;i<=1;i++)
- {
- d[i][0]=a[i][0]+c[i][0];
- e[i][0]=b[i][0]+c[i][0];
- }
- line(d[0][0],e[0][0],d[1][0],e[1][0]);
- getch();
- closegraph();
- }
Add Comment
Please, Sign In to add comment