Advertisement
Guest User

Untitled

a guest
May 9th, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class DrawTheWordPin
  8. {
  9. static void Main(string[] args)
  10. {
  11. int userInput = int.Parse(Console.ReadLine());
  12. int imageWidth = 6 * userInput + 10;
  13. if (userInput >= 2 &&
  14. userInput <= 20)
  15. {
  16. DrawTopLine(userInput, imageWidth);
  17. DrawUpperLines(userInput, imageWidth);
  18. DrawMiddleLine(userInput, imageWidth);
  19. DrawLowerLines(userInput, imageWidth);
  20. DrawBottomLine(userInput, imageWidth);
  21. }
  22. else
  23. {
  24. Console.WriteLine("Enter correct number between 2 and 20");
  25. }
  26. }
  27. private static void DrawTopLine(int userInput, int imageWidth)
  28. {
  29. Console.Write("/`");
  30. for (int i = 0; i < userInput * 2; i++)
  31. {
  32. Console.Write("P");
  33. }
  34. for (int i = 0; i < userInput; i++)
  35. {
  36. Console.Write(" ");
  37. }
  38. Console.Write("/`I");
  39. for (int i = 0; i < userInput; i++)
  40. {
  41. Console.Write(" ");
  42. }
  43. Console.Write("/`N");
  44. for (int i = 0; i <= userInput * 2; i++)
  45. {
  46. Console.Write(" ");
  47. }
  48. Console.Write("N\n");
  49. }
  50. private static void DrawUpperLines(int userInput, int imageWidth)
  51. {
  52. for (int a = 0; a < userInput - 1; a++)
  53. {
  54. Console.Write("| P");
  55. for (int b = 0; b < userInput * 2 - 2; b++)
  56. {
  57. Console.Write(" ");
  58. }
  59. Console.Write("P");
  60. for (int i = 0; i < userInput; i++)
  61. {
  62. Console.Write(" ");
  63. }
  64. Console.Write("| I");
  65. for (int i = 0; i < userInput; i++)
  66. {
  67. Console.Write(" ");
  68. }
  69. Console.Write("| N");
  70. for (int i = 0; i < a; i++)
  71. {
  72. Console.Write(" ");
  73. }
  74. Console.Write("N");
  75. for (int i = 0; i <= userInput * 2 - 1 - a; i++)
  76. {
  77. Console.Write(" ");
  78. }
  79. Console.Write("N\n");
  80. }
  81. }
  82. private static void DrawMiddleLine(int userInput, int imageWidth)
  83. {
  84. Console.Write("| ");
  85. for (int i = 0; i < userInput * 2; i++)
  86. {
  87. Console.Write("P");
  88. }
  89. for (int i = 0; i < userInput; i++)
  90. {
  91. Console.Write(" ");
  92. }
  93. Console.Write("| I");
  94. for (int i = 0; i < userInput; i++)
  95. {
  96. Console.Write(" ");
  97. }
  98. Console.Write("| N");
  99. for (int i = 0; i < userInput - 1; i++)
  100. {
  101. Console.Write(" ");
  102. }
  103. Console.Write("N");
  104. for (int i = 0; i <= userInput * 2 - userInput; i++)
  105. {
  106. Console.Write(" ");
  107. }
  108. Console.Write("N\n");
  109. }
  110. private static void DrawLowerLines(int userInput, int imageWidth)
  111. {
  112. for (int a = 0; a < userInput; a++)
  113. {
  114. Console.Write("| P");
  115. if (userInput > 2)
  116. {
  117. for (int i = 0; i < (userInput-2)/2; i++)
  118. {
  119. Console.Write("P");
  120. }
  121.  
  122. }
  123. else
  124. {
  125. Console.Write(" ");
  126. }
  127. for (int b = 0; b < userInput * 2 -1-(userInput-2)/2; b++)
  128. {
  129. Console.Write(" ");
  130. }
  131. for (int i = 0; i < userInput; i++)
  132. {
  133. Console.Write(" ");
  134. }
  135. Console.Write("| I");
  136. for (int i = 0; i < userInput; i++)
  137. {
  138. Console.Write(" ");
  139. }
  140. Console.Write("| N");
  141. for (int i = 0; i < userInput + a; i++)
  142. {
  143. Console.Write(" ");
  144. }
  145. Console.Write("N");
  146. for (int i = 0; i < userInput * 2 - userInput - a; i++)
  147. {
  148. Console.Write(" ");
  149. }
  150. Console.Write("N\n");
  151. }
  152. }
  153. private static void DrawBottomLine(int userInput, int imageWidth)
  154. {
  155. Console.Write("\\_P");
  156. if (userInput > 2)
  157. {
  158. for (int i = 0; i < (userInput-2)/2; i++)
  159. {
  160. Console.Write("P");
  161. }
  162.  
  163. }
  164. else
  165. {
  166. Console.Write(" ");
  167. }
  168. for (int b = 0; b < userInput * 2 -userInput/2; b++)
  169. {
  170. Console.Write(" ");
  171. }
  172. for (int i = 0; i < userInput; i++)
  173. {
  174. Console.Write(" ");
  175. }
  176. Console.Write("\\_I");
  177. for (int i = 0; i < userInput; i++)
  178. {
  179.  
  180.  
  181. Console.Write(" ");
  182.  
  183. }
  184. Console.Write("\\_N");
  185. for (int i = 0; i <= userInput; i++)
  186. {
  187. Console.Write(" ");
  188. }
  189. Console.Write(" ");
  190. for (int i = 0; i < userInput * 2 - userInput - 2; i++)
  191. {
  192. Console.Write(" ");
  193. }
  194. Console.Write("NN\n");
  195. }
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement