Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Print3(10, 10, ConsoleColor.Yellow);
- }
- static void Print8(int height, int width, ConsoleColor color)
- {
- Console.ForegroundColor = color;
- PrintHorizontal(width);
- PrintSides(height, width);
- PrintHorizontal(width);
- PrintSides(height, width);
- PrintHorizontal(width);
- }
- static void Print3(int height, int width, ConsoleColor color)
- {
- Console.ForegroundColor = color;
- PrintHorizontal(width);
- PrintRight(height, width);
- PrintHorizontal(width);
- PrintLeft(height);
- PrintHorizontal(width);
- }
- static void PrintHorizontal(int width)
- {
- Console.Write(" ");
- for (int i = 0; i < width - 2; i++)
- {
- Console.Write("*");
- }
- Console.Write("\n");
- }
- static void PrintSides(int height, int width)
- {
- for (int i = 0; i < (height - 3) / 2; i++)
- {
- Console.Write("*");
- for (int j = 0; j < width - 2; j++)
- {
- Console.Write(" ");
- }
- Console.Write("*\n");
- }
- }
- static void PrintRight(int height, int width)
- {
- for (int i = 0; i < (height - 3) / 2; i++)
- {
- for (int j = 0; j < width - 1; j++)
- {
- Console.Write(" ");
- }
- Console.Write("*\n");
- }
- }
- static void PrintLeft(int height)
- {
- for (int i = 0; i < (height - 3) / 2; i++)
- {
- Console.Write("*\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement