Air Service

mail@pastecode.io avatar
unknown
csharp
2 months ago
1.2 kB
5
Indexable
Never
Console.OutputEncoding = System.Text.Encoding.UTF8;

string[] menuItems = new string[] { "Забронировать билет", "Выход" };
int selectedIndex = 0;



while (true)
{
    Console.Clear();
    ShowMenu(menuItems);
    ConsoleKeyInfo keyInfo = Console.ReadKey();

    switch (keyInfo.Key)
    {
        case ConsoleKey.DownArrow:
            selectedIndex++;
            break;
        case ConsoleKey.UpArrow:
            selectedIndex--;
            break;
        default:
            break;
    } 
}


string[,] seats = new string[10, 4];

/*for (int i = 0; i < seats.GetLength(0); i++)
{
    for (int j = 0; j < seats.GetLength(1); j++)
    {
        Console.Write("[X] \t");

    }
    Console.WriteLine();
    Console.WriteLine();
}*/

void ShowMenu(string[] menuItems)
{
    Console.WriteLine("\tAir Astana");
    int a = 1;
    foreach (string item in menuItems)
    {
        if (a - 1 == selectedIndex)
        {
            Console.ForegroundColor = ConsoleColor.Blue;

        }
        else
        {
            Console.ResetColor();
        }
        Console.WriteLine(a + ". " + item);
        Console.ResetColor ();
        a++;
    }
}

Leave a Comment