Esempio n. 1
0
        static void Main(string[] args)
        {
            string    myChoice;
            TheMethod om = new TheMethod();

            do
            {
                myChoice = om.getChoice();
                // Make a decision based on the user's choice
                switch (myChoice)
                {
                case "A":
                case "a":
                    Console.WriteLine("You wish to add an address.");
                    break;

                case "D":
                case "d":
                    Console.WriteLine("You wish to delete an address.");
                    break;

                case "M":
                case "m":
                    Console.WriteLine("You wish to modify an address.");
                    break;

                case "V":
                case "v":
                    Console.WriteLine("You wish to view the address list.");
                    break;

                case "Q":
                case "q":
                    Console.WriteLine("Bye.");
                    break;

                default:
                    Console.WriteLine("{0} is not a valid choice", myChoice);
                    break;
                }
                // Pause to allow the user to see the results
                Console.WriteLine();
                Console.Write("press Enter key to continue...");
                Console.ReadLine();
                Console.WriteLine();
            } while (myChoice != "Q" && myChoice != "q"); // Keep going until the user wants to quit
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string myChoice;
            TheMethod om = new TheMethod();
            do
            {
                myChoice = om.getChoice();
                // Make a decision based on the user's choice
                switch (myChoice)
                {
                    case "A":
                    case "a":
                        Console.WriteLine("You wish to add an address.");
                        break;
                    case "D":
                    case "d":
                        Console.WriteLine("You wish to delete an address.");
                        break;
                    case "M":
                    case "m":
                        Console.WriteLine("You wish to modify an address.");
                        break;
                    case "V":
                    case "v":
                        Console.WriteLine("You wish to view the address list.");
                        break;
                    case "Q":
                    case "q":
                        Console.WriteLine("Bye.");
                        break;
                    default:
                        Console.WriteLine("{0} is not a valid choice", myChoice);
                        break;
                }
                // Pause to allow the user to see the results
                Console.WriteLine();
                Console.Write("press Enter key to continue...");
                Console.ReadLine();
                Console.WriteLine();

            } while (myChoice != "Q" && myChoice != "q"); // Keep going until the user wants to quit
        }