deleriumbg

Rocket

Jun 8th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Rocket
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Please enter a number:");
  10.             int n = int.Parse(Console.ReadLine());
  11.             DrawRocket(n);
  12.         }
  13.  
  14.         private static void DrawRocket(int n)
  15.         {
  16.             for (int i = 0; i < n * 2 - 1; i++)
  17.             {
  18.                 Console.WriteLine($"{new string(' ', 2 * n - 1 - i)}{new string('/', i + 1)}**{new string('\\', i + 1)}");
  19.             }
  20.  
  21.             PrintEqualsAndStars(n);
  22.             PrintTopPart(n);
  23.             PrintBottomPart(n);
  24.             PrintEqualsAndStars(n);
  25.             PrintBottomPart(n);
  26.             PrintTopPart(n);
  27.             PrintEqualsAndStars(n);
  28.  
  29.             for (int i = 0; i < n * 2 - 1; i++)
  30.             {
  31.                 if (i == n * 2 - 2 && n != 1)
  32.                 {
  33.                     Console.ForegroundColor = ConsoleColor.Green;
  34.                 }
  35.                 else if (i == n * 2 - 3)
  36.                 {
  37.                     Console.ForegroundColor = ConsoleColor.Blue;
  38.                 }
  39.                 else
  40.                 {
  41.                     Console.ForegroundColor = ConsoleColor.Red;
  42.                 }
  43.                 Console.WriteLine($"{new string(' ', 2 * n - 1 - i)}{new string('/', i + 1)}**{new string('\\', i + 1)}");
  44.             }
  45.         }
  46.  
  47.         private static void PrintBottomPart(int n)
  48.         {
  49.             for (int i = n; i > 0; i--)
  50.             {
  51.                 Console.Write($"|{new string('.', n - i)}");
  52.                 for (int j = 0; j < i; j++)
  53.                 {
  54.                     Console.Write("\\/");
  55.                 }
  56.                 Console.Write($"{new string('.', (n - i) * 2)}");
  57.                 for (int j = 0; j < i; j++)
  58.                 {
  59.                     Console.Write("\\/");
  60.                 }
  61.                 Console.Write($"{new string('.', n - i)}");
  62.                 Console.WriteLine("|");
  63.             }
  64.         }
  65.  
  66.         private static void PrintTopPart(int n)
  67.         {
  68.             for (int i = 0; i < n; i++)
  69.             {
  70.                 Console.Write($"|{new string('.', n - 1 - i)}");
  71.                 for (int j = 0; j <= i; j++)
  72.                 {
  73.                     Console.Write("/\\");
  74.                 }
  75.                 Console.Write($"{new string('.', (n - 1 - i) * 2)}");
  76.                 for (int j = 0; j <= i; j++)
  77.                 {
  78.                     Console.Write("/\\");
  79.                 }
  80.                 Console.Write($"{new string('.', n - 1 - i)}");
  81.                 Console.WriteLine("|");
  82.             }
  83.         }
  84.  
  85.         private static void PrintEqualsAndStars(int n)
  86.         {
  87.             Console.Write("+");
  88.             for (int i = 0; i < n * 2; i++)
  89.             {
  90.                 Console.Write("*=");
  91.             }
  92.             Console.WriteLine("+");
  93.         }
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment