Нарисовать рамку в консоли - C#
Формулировка задачи:
Нам задали задачу, нарисовать рамку с помощью вот этих символов как их вывести на экран? Подскажите плиз
static void DrawFrame(int x, int y, int width, int heigt)
{
//
Console.SetCursorPosition(x,y);
Console.Write("в•”");
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
// в•‘, в•—, в•ђ,в•љ,в•”
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•”");
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•ђ");
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•—");
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•‘");
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•љ");
Console.SetCursorPosition(x + j, y + i);
Console.Write("в•ќ");
}
}
}
static void Main(string[] args)
{
Console.ReadLine();Решение задачи: «Нарисовать рамку в консоли»
textual
Листинг программы
class Program
{
static void Main(string[] args)
{
int b = 51;
int c = 51;
Console.ForegroundColor = ConsoleColor.Green;
for (int i = 0; i < 8; i++) // верх
{
Console.SetCursorPosition(1, 2);
Console.CursorLeft = b;
Console.Write("в•”");
b -= 7;
}
for (int a = 1; a < 10; a++) // лево право
{
Console.SetCursorPosition(2, a + 2);
Console.WriteLine("в•‘");
Console.SetCursorPosition(51, a + 2);
Console.WriteLine("в•љ");
}
for (int i = 0; i < 8; i++) //низ
{
Console.SetCursorPosition(1, 12);
Console.CursorLeft = c;
Console.Write("в•ќ");
c -= 7;
}
Console.Read();
}
}