Advertisement
VickyFilly

C#Basics_ChristmasToy

Feb 24th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.29 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _5Question
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int number = int.Parse(Console.ReadLine());
  10.  
  11.             int width = 5 * number;
  12.             int height = (2 * number) + 3;
  13.  
  14.             int firstrowstars = number;
  15.             int firstrowdashes = (width - number) / 2;
  16.             string firstrowofstars = new string('*', firstrowstars);
  17.             string firstrowofdashes = new string('-', firstrowdashes);
  18.  
  19.             Console.WriteLine("{0}{1}{0}", firstrowofdashes, firstrowofstars); // REMINDER: first row & last row
  20.  
  21.             var dashessecondrow = (width - firstrowstars - 4) / 2;
  22.  
  23.             var andsymbol = number + 2;
  24.  
  25.             var starssecondrow = 1;                      //(number / 2 ) / 2 - doesn't work with bigger numbers.
  26.  
  27.             for (int row2 = 0; row2 < number / 2; row2++)    // REMINDER: reverse it for bottom part
  28.             {
  29.                 string dashesforsecondrow = new string('-', dashessecondrow);
  30.                 string andsymbols = new string('&', andsymbol);
  31.                 string starsforsecondrow = new string('*', starssecondrow);
  32.                 Console.WriteLine("{0}{1}{2}{1}{0}", dashesforsecondrow, starsforsecondrow, andsymbols);
  33.  
  34.                 dashessecondrow -= 2;
  35.                 andsymbol += 2;
  36.                 starssecondrow++;
  37.             }
  38.  
  39.             dashessecondrow += 1;
  40.  
  41.             var waves = width - (dashessecondrow * 2) - 4;
  42.  
  43.             for (int row3 = 0; row3 < number / 2; row3++)
  44.             {
  45.                 string dashesforsecondrow = new string('-', dashessecondrow);
  46.                 string wavesforsecondrow = new string('~', waves);
  47.  
  48.                 Console.WriteLine("{0}**{1}**{0}", dashesforsecondrow, wavesforsecondrow);
  49.  
  50.                 dashessecondrow--;
  51.                 waves += 2;
  52.             }
  53.  
  54.             dashessecondrow++;
  55.  
  56.             var column = width - (dashessecondrow * 2) - 2;
  57.             string dashesmidrow = new string('-', dashessecondrow);
  58.             string columnrow = new string('|', column);
  59.             Console.WriteLine("{0}*{1}*{0}", dashesmidrow, columnrow);
  60.  
  61.             waves -= 2;
  62.  
  63.             for (int row3 = 0; row3 < number / 2; row3++)
  64.             {
  65.                 string dashesforsecondrow = new string('-', dashessecondrow);
  66.                 string wavesforsecondrow = new string('~', waves);
  67.                 Console.WriteLine("{0}**{1}**{0}", dashesforsecondrow, wavesforsecondrow);
  68.                 waves -= 2;
  69.                 dashessecondrow++;
  70.             }
  71.  
  72.             andsymbol -= 2;
  73.             starssecondrow--;
  74.  
  75.             for (int row2 = 0; row2 < number / 2; row2++)    // REMINDER: reverse it for bottom part
  76.             {
  77.                 string dashesforsecondrow = new string('-', dashessecondrow);
  78.                 string andsymbols = new string('&', andsymbol);
  79.                 string starsforsecondrow = new string('*', starssecondrow);
  80.                 Console.WriteLine("{0}{1}{2}{1}{0}", dashesforsecondrow, starsforsecondrow, andsymbols);
  81.  
  82.                 dashessecondrow += 2;
  83.                 andsymbol -= 2;
  84.                 starssecondrow--;
  85.             }
  86.  
  87.             Console.WriteLine("{0}{1}{0}", firstrowofdashes, firstrowofstars);
  88.  
  89.         }
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement