simonradev

StopSign

Mar 12th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 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 StopSign
  8. {
  9.     class StopSign
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.  
  15.             //printing the top row
  16.             int sideDots = size + 1;
  17.             int middleDashes = (size * 2 + 1) - 4;
  18.             for (int currRow = 0; currRow < size + 1; currRow++)
  19.             {
  20.                 char leftBorder = currRow == 0 ? '_' : '/';
  21.                 char rightBorder = currRow == 0 ? '_' : '\\';
  22.  
  23.                 Console.Write(new string('.', sideDots - currRow));
  24.                 Console.Write(new string(leftBorder, 2));
  25.                 Console.Write(new string('_', middleDashes));
  26.                 Console.Write(new string(rightBorder, 2));
  27.                 Console.WriteLine(new string('.', sideDots - currRow));
  28.  
  29.                 middleDashes += 2;
  30.             }
  31.  
  32.             //printing the mid part
  33.             int dashesAroundStopText = (middleDashes - 5) / 2;
  34.             Console.WriteLine("//" +
  35.                               new string('_', dashesAroundStopText) +
  36.                               "STOP!" +
  37.                               new string('_', dashesAroundStopText) +
  38.                               @"\\");
  39.  
  40.             //printing the bot part
  41.             for (int currRow = 0; currRow < size; currRow++)
  42.             {
  43.                 Console.Write(new string('.', currRow));
  44.                 Console.Write(@"\\");
  45.                 Console.Write(new string('_', middleDashes));
  46.                 Console.Write("//");
  47.                 Console.WriteLine(new string('.', currRow));
  48.  
  49.                 middleDashes -= 2;
  50.             }
  51.         }
  52.     }
  53. }
Add Comment
Please, Sign In to add comment