Advertisement
Vermiculus

Untitled

Mar 14th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. static int Menu(string[] options) {
  2.     for(int i = 0; i < options.length; i++) {
  3.         Console.WriteLine("[{0}] {1}", i+1, options[i]);
  4.     }
  5.     Console.Write("Pick your fate: ");
  6.     int choice = getInt("ENTER A NUMBER, WHOREEEEE. :)");
  7.     while(choice < 0 || choice >= options.length) {
  8.         Console.WriteLine("You fail at directions. Enter a NUMBER, whore.");
  9.         Console.Write("Pick your fate: ");
  10.         input = Console.ReadLine();
  11.     }
  12. }
  13.  
  14. static int getInt(string failMsg="Enter a number.") {
  15.     string input = Console.ReadLine();
  16.     int choice;
  17.     while(!int.TryParse(input, out choice)) {
  18.         Console.WriteLine(failMsg);
  19.         input = Console.ReadLine();
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement