Не получается нарисовать рамку в консоли - C#
Формулировка задачи:
Добрый день!
Мучаюсь, капаюсь и не получается нарисовать такую рамку в консоли, вот задние:
Вот код который успел нарыть, для примера.
Может кто-то поможет...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Task8_10
{
class Program
{
static void Main(string[] args)
{
Console.Write('в•”');
for (int index = 1; index != 79; index++)
Console.Write('в•ђ');
Console.Write('в•—');
for (int index = 1; index != 49; index++)
{
Console.Write('в•‘');
Console.CursorLeft = 79;
Console.Write('в•‘');
}
Console.Write('в•љ');
for (int index = 1; index != 79; index++)
Console.Write('в•ђ');
Console.Write('в•ќ');
Console.ReadLine();
}
}
}Решение задачи: «Не получается нарисовать рамку в консоли»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Task8_10
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Как желаете заполнить?");
Console.WriteLine("Цифра 1 = в столбик, цифра 2 = в строчку");
int valMethod = Convert.ToInt32(Console.ReadLine());
Console.Clear();
Console.SetCursorPosition(1, 0);
for (int index = 1; index != 22; index++)
{
Console.CursorLeft = 1;
Console.WriteLine('в•‘');
if (index < 21)
{
Console.CursorLeft = 19;
Console.Write('в•‘');
}
}
Console.SetCursorPosition(1, 0);
for (int index = 1; index != 62; index++)
Console.Write('в•ђ');
Console.SetCursorPosition(35, 1);
int valueRow = 0;
for (int i = 0; i < 4; i++)
{
for (int index = 1; index != 20; index++)
{
Console.SetCursorPosition(28 + valueRow, 1 + index);
Console.WriteLine('в•‘');
}
valueRow += 8;
}
for (int index = 1; index != 20; index++)
{
Console.SetCursorPosition(29 + valueRow, 0 + index);
Console.WriteLine('в•‘');
}
Console.SetCursorPosition(20, 2);
for (int index = 1; index != 43; index++)
Console.Write('в•ђ');
int value = 4;
for (int i = 0; i < 9; i++)
{
Console.SetCursorPosition(1, value);
for (int index = 1; index != 62; index++)
Console.Write('в•ђ');
value += 2;
}
Console.SetCursorPosition(6, 2);
Console.WriteLine("Спортсмен");
Console.SetCursorPosition(25, 1);
Console.WriteLine("Вид спорта");
int value1 = 5;
for (int i = 1; i < 9; i++)
{
Console.SetCursorPosition(6, value1);
Console.WriteLine("{0}", i);
value1 += 2;
}
int value2 = 2;
for (int i = 1; i < 6; i++)
{
Console.SetCursorPosition(22 + value2, 3);
Console.Write("{0}", i);
value2 += 8;
}
Console.SetCursorPosition(1, 0);
Console.Write("в•”");
Console.SetCursorPosition(61, 0);
Console.Write("в•—");
Console.SetCursorPosition(1, 20);
Console.Write("в•љ");
Console.SetCursorPosition(61, 20);
Console.Write("в•ќ");
if (valMethod == 1)
{
InputColumn();
}
else if (valMethod == 2)
{
InputRow();
}
else
{
Console.WriteLine("Вы ввели неправильное значение");
}
Console.ReadLine();
}
static void InputColumn()
{
int value3 = 0;
int value4 = 5;
for (int j = 0; j < 5; j++)
{
for (int i = 0; i < 8; i++)
{
Console.SetCursorPosition(24 + value3, value4);
Console.ReadLine();
value4 += 2;
}
value4 = 5;
value3 += 8;
}
Console.SetCursorPosition(5, 22);
Console.WriteLine("Спасибо Alex за использование программы!");
}
static void InputRow()
{
int value3 = 0;
int value4 = 5;
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 5; i++)
{
Console.SetCursorPosition(24 + value3, value4);
Console.ReadLine();
value3 += 8;
}
value4 += 2;
value3 = 0;
}
Console.SetCursorPosition(5, 22);
Console.WriteLine("Спасибо Alex за использование программы!");
}
}
}