yoyoboyss

Untitled

Jun 13th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <graphics.h>
  3. #include <winbgim.h>
  4.  
  5. using namespace std;
  6.  
  7. const int MMAX = 500;
  8. const int LMAX = 800;
  9. const int HMAX = 600;
  10. const int NMAX = 100;
  11.  
  12. int N, R = 300, cnt;
  13. int x_1, y_1, x_2, y_2;
  14. int ans[MMAX][4];
  15. char s[NMAX];
  16.  
  17. int drawTriangleV(int, int, int);
  18.  
  19. int drawTriangleA(int edgeLenght, int x, int y){
  20. int ok = 0;
  21. if(s[cnt + 1] == '(')
  22. ok = 1;
  23.  
  24. line(x, y - 2 * edgeLenght * 1.72 / 6, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  25. printf("%d %d %d %d\n", x, y - 2 * edgeLenght * 1.72 / 6, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  26. if(ok){
  27. cnt += 2;
  28. if(s[cnt + 1] == ')')
  29. ok = 0;
  30. if(s[cnt] != '#'){
  31. if(s[cnt] == 'A')
  32. drawTriangleA(edgeLenght / 2, x, y - 2 * edgeLenght * 1.72 / 6);
  33. else if(s[cnt] == 'V')
  34. drawTriangleV(edgeLenght / 2, x, y - 2 * edgeLenght * 1.72 / 6);
  35. }
  36. }
  37.  
  38. line(x - edgeLenght / 2, y + edgeLenght * 1.72 / 6, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  39. printf("%d %d %d %d\n", x - edgeLenght / 2, y + edgeLenght * 1.72 / 6, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  40. if(ok){
  41. cnt += 2;
  42. if(s[cnt + 1] == ')')
  43. ok = 0;
  44. if(s[cnt] != '#'){
  45. if(s[cnt] == 'A')
  46. drawTriangleA(edgeLenght / 2, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  47. else if(s[cnt] == 'V')
  48. drawTriangleV(edgeLenght / 2, x + edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  49. }
  50. }
  51.  
  52. line(x, y - 2 * edgeLenght * 1.72 / 6, x - edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  53. printf("%d %d %d %d\n", x, y - 2 * edgeLenght * 1.72 / 6, x - edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  54. if(ok){
  55. cnt += 2;
  56. if(s[cnt + 1] == ')')
  57. ok = 0;
  58. if(s[cnt] != '#'){
  59. if(s[cnt] == 'A')
  60. drawTriangleA(edgeLenght / 2, x - edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  61. else if(s[cnt] == 'V')
  62. drawTriangleV(edgeLenght / 2, x - edgeLenght / 2, y + edgeLenght * 1.72 / 6);
  63. }
  64. }
  65. }
  66.  
  67. int drawTriangleV(int edgeLenght, int x, int y){
  68. int ok = 0;
  69. if(s[cnt + 1] == '(')
  70. ok = 1;
  71.  
  72. line(x + edgeLenght / 2, y - edgeLenght * 1.72 / 6, x, y + 2 * edgeLenght * 1.72 / 6);
  73. printf("%d %d %d %d\n", x + edgeLenght / 2, y - edgeLenght * 1.72 / 6, x, y + 2 * edgeLenght * 1.72 / 6);
  74. if(ok){
  75. cnt += 2;
  76. if(s[cnt + 1] == ')')
  77. ok = 0;
  78. if(s[cnt] != '#'){
  79. if(s[cnt] == 'A')
  80. drawTriangleA(edgeLenght / 2, x + edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  81. else if(s[cnt] == 'V')
  82. drawTriangleV(edgeLenght / 2, x + edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  83. }
  84. }
  85.  
  86. line(x - edgeLenght / 2, y - edgeLenght * 1.72 / 6, x, y + 2 * edgeLenght * 1.72 / 6);
  87. printf("%d %d %d %d\n", x - edgeLenght / 2, y - edgeLenght * 1.72 / 6, x, y + 2 * edgeLenght * 1.72 / 6);
  88. if(ok){
  89. cnt += 2;
  90. if(s[cnt + 1] == ')')
  91. ok = 0;
  92. if(s[cnt] != '#'){
  93. if(s[cnt] == 'A')
  94. drawTriangleA(edgeLenght / 2, x, y + 2 * edgeLenght * 1.72 / 6);
  95. else if(s[cnt] == 'V')
  96. drawTriangleV(edgeLenght / 2, x, y + 2 * edgeLenght * 1.72 / 6);
  97. }
  98. }
  99.  
  100. line(x - edgeLenght / 2, y - edgeLenght * 1.72 / 6, x + edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  101. printf("%d %d %d %d\n", x - edgeLenght / 2, y - edgeLenght * 1.72 / 6, x + edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  102. if(ok){
  103. cnt += 2;
  104. if(s[cnt + 1] == ')')
  105. ok = 0;
  106. if(s[cnt] != '#'){
  107. if(s[cnt] == 'A')
  108. drawTriangleA(edgeLenght / 2, x - edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  109. else if(s[cnt] == 'V')
  110. drawTriangleV(edgeLenght / 2, x - edgeLenght / 2, y - edgeLenght * 1.72 / 6);
  111. }
  112. }
  113. }
  114.  
  115. int main(){
  116.  
  117. initwindow(LMAX, HMAX, "The Beauty of Code", 250, 50);
  118.  
  119. freopen("TRIUNGHI.TXT", "w", stdout);
  120. freopen("triunghi.in", "r", stdin);
  121.  
  122. scanf("%s", s);
  123.  
  124. cnt = 0;
  125. if(s[cnt] == 'V')
  126. drawTriangleV(300, LMAX / 2, HMAX / 2);
  127. else
  128. drawTriangleA(300, LMAX / 2, HMAX / 2);
  129.  
  130. getch();
  131. closegraph();
  132.  
  133. return 0;
  134. }
Advertisement
Add Comment
Please, Sign In to add comment