Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Print3(10, 10, ConsoleColor.Yellow);
  13.         }
  14.         static void Print8(int height, int width, ConsoleColor color)
  15.         {
  16.             Console.ForegroundColor = color;
  17.             PrintHorizontal(width);
  18.             PrintSides(height, width);
  19.             PrintHorizontal(width);
  20.             PrintSides(height, width);
  21.             PrintHorizontal(width);
  22.         }
  23.         static void Print3(int height, int width, ConsoleColor color)
  24.         {
  25.             Console.ForegroundColor = color;
  26.             PrintHorizontal(width);
  27.             PrintRight(height, width);
  28.             PrintHorizontal(width);
  29.             PrintLeft(height);
  30.             PrintHorizontal(width);
  31.         }
  32.         static void PrintHorizontal(int width)
  33.         {
  34.             Console.Write(" ");
  35.             for (int i = 0; i < width - 2; i++)
  36.             {
  37.                 Console.Write("*");
  38.             }
  39.             Console.Write("\n");
  40.         }
  41.         static void PrintSides(int height, int width)
  42.         {
  43.             for (int i = 0; i < (height - 3) / 2; i++)
  44.             {
  45.                 Console.Write("*");
  46.                 for (int j = 0; j < width - 2; j++)
  47.                 {
  48.                     Console.Write(" ");
  49.                 }
  50.                 Console.Write("*\n");
  51.  
  52.             }
  53.         }
  54.         static void PrintRight(int height, int width)
  55.         {
  56.             for (int i = 0; i < (height - 3) / 2; i++)
  57.             {
  58.                 for (int j = 0; j < width - 1; j++)
  59.                 {
  60.                     Console.Write(" ");
  61.                 }
  62.                 Console.Write("*\n");
  63.  
  64.             }
  65.         }
  66.         static void PrintLeft(int height)
  67.         {
  68.             for (int i = 0; i < (height - 3) / 2; i++)
  69.             {
  70.                 Console.Write("*\n");
  71.  
  72.             }
  73.         }
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement