static void MainWindow()
{
Console.Clear();
Console.WriteLine("Menu");
Console.WriteLine("");
Console.WriteLine("1. Information");
Console.WriteLine("2. Contact");
Console.WriteLine("3. Extra");
Console.WriteLine("q. Exit");
string myOptions;
myOptions = Console.ReadLine();
switch (myOptions)
{
case "1":
Information();
break;
case "2":
Contact();
break;
case "3":
Extra();
break;
case "q":
Exit();
break;
default:
Console.Clear();
Console.WriteLine("Input is wrong");
Console.ReadKey();
MainWindow();
break;
}
Console.ReadLine();
}
I make a console menu and I need a counter that will count wrong entries. if it hits 5 times, the user is thrown back to the main menu.
I was trying to do this with while statement but it didnt work for me.