teotod

Task 5 -an incorrect solution to the task

Mar 26th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1.  static void Main(string[] args)
  2.         {
  3.             int n = int.Parse(Console.ReadLine());
  4.  
  5.             int width = 2 * n + 2;
  6.             int spaceLeft = n - 2;
  7.             int spaceMiddle = 2;
  8.  
  9.             for (int i = 0; i < n - 1; i++)
  10.             {
  11.  
  12.                 Console.WriteLine("{0}/{1}|{2}|{1}\\", new string(' ', spaceLeft), new string(' ', i), new string(' ', spaceMiddle));
  13.                 spaceLeft--;
  14.             }
  15.  
  16.             Console.WriteLine($"{new string('-', width)}");
  17.  
  18.             int row = n / 2 + 5;
  19.             for (int j = 1; j <= row; j++)
  20.             {
  21.                 int space = n / 3;
  22.                 if (j == 1)
  23.                 {
  24.                     Console.WriteLine("|{0}_{1}_{0}|", new string(' ', space), new string(' ', n + 1));
  25.                 }
  26.                 else if (j == 2)
  27.                 {
  28.                     Console.WriteLine("|{0}@{1}@{0}|", new string(' ', space), new string(' ', n + 1));
  29.                 }
  30.                 else if (j == row)
  31.                 {
  32.                     int spaces = (width - 6) / 2;
  33.                     Console.WriteLine("|{0}||||{0}|", new string(' ', spaces));
  34.                 }
  35.                 else if (j == row - 1)
  36.                 {
  37.                     int spaces = (width - 6) / 2;
  38.                     Console.WriteLine("|{0}/  \\{0}|", new string(' ', spaces));
  39.                 }
  40.                 else if (j == row - 2)
  41.                 {
  42.                     int spaces = (width - 4) / 2;
  43.                     Console.WriteLine("|{0}oo{0}|", new string(' ', spaces));
  44.                 }
  45.                 else
  46.                 {
  47.                     Console.WriteLine($"|{new string(' ', width - 2)}|");
  48.                 }
  49.             }
  50.  
  51.             int symbol = width - 2;
  52.             for (int i = 1; i <= n + 1; i++)
  53.             {
  54.                 Console.WriteLine("{0}{1}{2}", new string('\\', i), new string('`', symbol), new string('/', i));
  55.                 symbol -= 2;
  56.  
  57.             }
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment