Airplane
Airplaneunknown
csharp
2 years ago
1.1 kB
5
Indexable
string[] menuItems = new string[]
{
"Zabronirovat",
"Exit"
};
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 ");
}
Console.WriteLine();
}
void ShowMenu(string[] menuItems)
{
Console.WriteLine("Menu:");
int a = 1;
foreach (string item in menuItems)
{
if (a - 1 == selectedIndex)
{
Console.ForegroundColor = ConsoleColor.Blue;
}
else
{
Console.ResetColor();
}
Console.Write(a + ". " + item);
Console.ResetColor();
a++;
Console.WriteLine();
}
}Editor is loading...
Leave a Comment