Advertisement
zoro-10

6A. Write a program to implement 2D scaling.

Apr 1st, 2024
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<graphics.h>
  2. #include<iostream.h>
  3. #include<conio.h>
  4. #include<math.h>
  5. void main()
  6. {
  7. int gd=DETECT,gm,x2,y2,x1,y1,x,y;
  8. initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
  9. cout<<"Enter the value of x1 and y1: ";
  10. cin>>x1>>y1;
  11. cout<<"Enter the value of x2 and y2: ";
  12. cin>>x2>>y2;
  13. line(x1,y1,x2,y2);
  14. cout<<"Enter scaling co-ordinates: ";
  15. cin>>x>>y;
  16. x1=(x1*x);
  17. y1=(y1*y);
  18. x2=(x2*x);
  19. y2=(y2*y);
  20. cout<<"Line after scaling";
  21. line(x1,y1,x2,y2);
  22. getch();
  23. closegraph();
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement