hey all,
i have a RLE and ROT13 program at the start you have an option Press e or c or q to encrypt, compress or quit, but im not sure at the end of the program how to loop it back round so user can enter e,c or q again if they want to??
hope someone can help
thanks a lot
=)
C# looping
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Jun 14, 2009, 6:03 AM EDT
static void Main(string[] args) { Console.WriteLine("Press Esc to Exit"); ConsoleKeyInfo Key = Console.ReadKey(); // If Escape is Pressed then Application Will exit if (Key.KeyChar == (char)(27)) { Process.GetCurrentProcess().Kill(); } else { Main(null); } }Kirtan PatelRank #292 · 8.6K reputationPosted Jun 14, 2009, 3:15 AM EDT
static void Main(string[] args) { Console.WriteLine("Hello"); // Call Main Method Again Main(null) ; }billy york5 reputationPosted Jun 14, 2009, 5:19 AM EDT
this helped a lot thanks, is there any way i can assign a key to exit e.g: if someones presses esc then this closes program??
thanks
billy york5 reputationPosted Jun 14, 2009, 6:52 AM EDT
got it all sorted =))