gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
generate console menu using c# with options
- User
generate console menu using c# with options
- Assistant
Sure! Here's an example of a console menu using C# with options:
csharp
generate console menu using c# with options
Sure! Here's an example of a console menu using C# with options:
using System;
class Program
{
static void Main(string[] args)
{
bool exit = false;
while (!exit)
{
Console.Clear();
Console.WriteLine("Console Menu");
Console.WriteLine("1. Option 1");
Console.WriteLine("2. Option 2");
Console.WriteLine("3. Option 3");
Console.WriteLine("4. Exit");
Console.Write("Select an option: ");
string input = Console.ReadLine();
Console.WriteLine();
switch (input)
{
case "1":
Console.WriteLine("You selected Option 1.");
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
break;
case "2":
Console.WriteLine("You selected Option 2.");
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
break;
case "3":
Console.WriteLine("You selected Option 3.");
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
break;
case "4":
exit = true;
break;
default:
Console.WriteLine("Invalid option. Please try again.");
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
break;
}
}
}
}
This example presents a menu with four options. The user can enter the corresponding number to select an option. Option 4 exits the program. For options 1-3, a message is displayed indicating the selected option, and the program waits for the user to press any key before returning to the menu.
Not yet included in a published release.