Advertisement
Guest User

03 - beer

a guest
Jan 12th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 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. namespace _03_beer
  8. {
  9. class Beer
  10. {
  11. static void DrawLineElements(int l, int m, int width, string a)
  12. {
  13. for(int i=0; i<width; i++)
  14. {
  15. if(i==l || i==m)
  16. {
  17. Console.Write("*");
  18. }
  19. else
  20. {
  21. Console.Write(a);
  22. }
  23. }
  24. Console.WriteLine();
  25.  
  26. }
  27. static void Main(string[] args)
  28. {
  29. int n = int.Parse(Console.ReadLine());
  30. int width = n * 2;
  31. int widthTop = n + 1;
  32. int height = n * 3 + 1;
  33.  
  34. int leftRight = (width - widthTop) / 2;
  35.  
  36. //firstLine
  37. for (int i=0; i<width-leftRight; i++)
  38. {
  39. if(i<leftRight || i>(width-1-leftRight))
  40. {
  41. Console.Write(" ");
  42. }
  43. else
  44. {
  45. Console.Write("*");
  46. }
  47. }
  48. Console.WriteLine();
  49.  
  50. //top bottle
  51. for (int j = 0; j <= leftRight; j++ )
  52. {
  53. for (int i = 0; i < width; i++)
  54. {
  55. if (i == leftRight || i == (width -1- leftRight))
  56. {
  57. Console.Write("*");
  58. }
  59. else
  60. {
  61. Console.Write(" ");
  62. }
  63. }
  64. Console.WriteLine();
  65. }
  66. for (int j = leftRight-1; j > 0; j--)
  67. {
  68. DrawLineElements(j, width - 1-j, width, " ");
  69.  
  70. }
  71. for (int i = 0; i < n; i++ )
  72. {
  73. DrawLineElements(0, width-1, width, ".");
  74. }
  75. for (int i = 0; i < n; i++)
  76. {
  77. DrawLineElements(0, width - 1, width, "@");
  78. }
  79. DrawLineElements(0, 1, width, "*");
  80.  
  81.  
  82. Console.ReadLine();
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement