braveheart1989

Cube-3D

Jul 12th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 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 _04.Cube_3D
  8. {
  9.     class Program
  10.     {
  11.         static void TopPartCube3D(int n)
  12.         {
  13.             int colon = n;
  14.             int space=n-2;
  15.             int verticalLine=1;
  16.             Console.WriteLine("{0}",new string(':',colon));
  17.             Console.WriteLine(":{0}::", new string(' ', space));
  18.             for (int row = 1; row <= n - 2; row++)
  19.             {                
  20.                 if (row == n-2)
  21.                 {
  22.                     Console.WriteLine("{0}{1}:", new string(':', colon),
  23.                     new string('|', verticalLine));
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine(":{0}:{1}:", new string(' ', space), new string('|', verticalLine));
  28.                     verticalLine++;
  29.                 }
  30.             }
  31.             int minus = n-2;
  32.             verticalLine--; ;
  33.             colon = 1;
  34.             space = 1;
  35.             for (int row = 0; row < n-2; row++)
  36.             {
  37.                 Console.WriteLine("{0}:{1}:{2}:", new string(' ', space), new string('-', minus),
  38.                     new string('|', verticalLine));
  39.                 verticalLine--;
  40.                 space++;
  41.             }
  42.             colon =n;
  43.  
  44.             Console.WriteLine("{0}{1}", new string(' ', space),new string(':', colon));
  45.         }
  46.         static void Main(string[] args)
  47.         {
  48.             int n = int.Parse(Console.ReadLine());
  49.             TopPartCube3D(n);
  50.         }
  51.     }
  52. }
Add Comment
Please, Sign In to add comment