Myth0147

Untitled

Jan 28th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<math.h>
  4. #include<graphics.h>
  5. void main()
  6. {
  7. clrscr;
  8. int gd=DETECT,gm;
  9. initgraph(&gd,&gm,"c:\\tc\\bgi");
  10. int x1,x2,y1,y2,a[3][5],j,b[3][3],c[3][5];
  11. cout<<"enter the 1st diagnol coordinates of rectangle:\n";
  12. cin>>x1>>y1;
  13. cout<<"\n enter the 2nd diagnol coordinates : \n";
  14. cin>>x2>>y2;
  15. rectangle(x1,y1,x2,y2);
  16. cout<<"\n the matrix for rectangle : \n";
  17. a[1][1]=x1;
  18. a[1][2]=x2;
  19. a[1][3]=x2;
  20. a[1][4]=x1;
  21. a[2][1]=y1;
  22. a[2][2]=y1;
  23. a[2][3]=y2;
  24. a[2][4]=y2;
  25. for(int i=1;i<3;i++)
  26. {
  27. for(j=1;j<5;j++)
  28. {
  29. cout<<a[i][j]<<"\t";
  30. }
  31. cout<<"\n";
  32. }
  33. b[1][1]=2;
  34. b[1][2]=0;
  35. b[2][1]=0;
  36. b[2][2]=3;
  37. cout<<"\n the scaling matrix:\n";
  38. for(i=1;i<3;i++)
  39. {
  40. for(j=1;j<3;j++)
  41. {
  42. cout<<b[i][j]<<"\t";
  43. }
  44. cout<<"\n";
  45. }
  46. for(i=1;i<3;i++)
  47. {
  48. for(j=1;j<5;j++)
  49. {
  50. c[i][j]=0;
  51. for(int k=1;k<3;k++)
  52. {
  53. c[i][j]+=b[i][k]*a[k][j];
  54. }
  55. }
  56. cout<<"\n the transformed matrix \n";
  57. for(i=1;i<3;i++)
  58. {
  59. for(j=1;j<5;j++)
  60. {
  61. cout<<c[i][j]<<"\t";
  62. }
  63. cout<<"\n";
  64. }
  65. rectangle(c[1][1],c[2][1],c[1][3],c[2][3]);
  66. getch();
  67. closegraph();
  68. }
  69. }
Add Comment
Please, Sign In to add comment