Created
March 16, 2017 05:59
-
-
Save 121jigowatts/596374bb140ffa3a401721354e61e878 to your computer and use it in GitHub Desktop.
Choose your life
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace choice | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Enter option 1."); | |
var option1 = Console.ReadLine(); | |
Console.WriteLine("Enter option 2."); | |
var option2 = Console.ReadLine(); | |
Console.WriteLine("Press any key!"); | |
Console.ReadKey(true); | |
var random = new System.Random(); | |
var result = random.Next(2); | |
if (result == 0) | |
{ | |
Console.WriteLine($"{option1}!"); | |
} | |
else | |
{ | |
Console.WriteLine($"{option2}!"); | |
} | |
Console.ReadKey(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2択で迷ったときはプログラムで解決