Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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!
 You open the door to find the room as if it were untouched. Strange.
  TRY AGAIN.");
                    return;
                    

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

                case "3":
                    Console.WriteLine(" You choose the second key. The door doesn't open.
 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?"");
            
        }
Comment

PREVIOUS NEXT
Code Example
Csharp :: calculator using single readline c# 
Csharp :: c# array accessor 
Csharp :: get first and last item list c# 
Csharp :: getString 
Csharp :: linq pick random element 
Csharp :: c# Isolation Levels 
Csharp :: Smooth Sentences c# 
Csharp :: eleventy set default layout 
Csharp :: button Previous for picturebox c# 
Csharp :: c# int array add number 
Csharp :: c# make a negative number positive 
Csharp :: c# get first word of string 
Csharp :: c# mapper.map 
Csharp :: unity in app review 
Csharp :: linq where c# 
Csharp :: how to get the index of an element in a list in unity 5 
Csharp :: unity audio source playoneshot 
Csharp :: function on program stops unity 
Csharp :: read administrator account remote machine C# 
Csharp :: random number between 1 and 100 c# 
Html :: how to use unsplash images in html 
Html :: how open link in new tab 
Html :: HP cmd get computer serial number 
Html :: pattern for email id in html 
Html :: fa icons profile 
Html :: how to switch between html pages 
Html :: Making a Phone number a link 
Html :: stop video javascript 
Html :: write & in html 
Html :: how to comment out html 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =