Air Service

 avatar
unknown
csharp
a year ago
1.2 kB
9
Indexable
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++;
    }
}

Editor is loading...
Leave a Comment