Horje
how to if i enter 1 go to this program C# Code Example
how to if i enter 1 go to this program C#
Console.Write("Type OPEN or KNOCK: ");
        string doorChoice = Console.ReadLine();
        string capDoor = doorChoice.ToUpper();
        Console.WriteLine();

        if (capDoor == "OPEN")
        {
            Console.WriteLine(" The door is locked! See if one of your three keys will open it.");
            Console.Write("Enter a number (1-3): ");

            string keyChoice = Console.ReadLine();

            //Respone to the preferred key choice
            switch (keyChoice)
            {
                case "1":
                    Console.WriteLine(" You fumble getting the key into the lock, but it works!\n You open the door to find the room as if it were untouched. Strange.\n  TRY AGAIN.");
                    return;
                    

                case "2":
                    Console.WriteLine(" You choose the second key. The door doesn't open.\n TRY AGAIN");
                    return;

                case "3":
                    Console.WriteLine(" You choose the second key. The door doesn't open.\n TRY AGAIN");
                    return;
            }
        }
        else if (capDoor == "KNOCK")
        {
            Console.WriteLine(" A voice behind the door speaks to you. It says, \"Answer this riddle: \"");
            Console.WriteLine(" \"Poor people have it. Rich people need it. If you eat it you die. What is it?\"");
            
        }




Csharp

Related
c# get innermost exception Code Example c# get innermost exception Code Example
which of the following string methods can be used to determine if a string contains only ā€˜\n’ characters? Code Example which of the following string methods can be used to determine if a string contains only ā€˜\n’ characters? Code Example
OBSERVER Code Example OBSERVER Code Example
c# datetime serialization issues Code Example c# datetime serialization issues Code Example
fixed angle unity Code Example fixed angle unity Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9