Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CoinFlip
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rng = new Random();
- Console.WriteLine(@"
- This program will allow you to guess heads or tails on a coin flip.
- Please enter h for heads, or t for tails and press Enter: ");
- char userGuess = (char)Console.Read();
- int coin = rng.Next(0,2);
- Console.WriteLine("Coin is {0}nn", coin);
- if (coin == 0 && (userGuess == 'h' || userGuess == 'H'))
- {
- Console.WriteLine("It's heads! You win!");
- }
- else if (coin == 1 && (userGuess == 't' || userGuess == 'T'))
- {
- Console.WriteLine("It's tails! You win!");
- }
- else if (userGuess != 't' && userGuess != 'T' && userGuess != 'h' && userGuess != 'H')
- {
- Console.WriteLine("You dumb mofo, you didn't enter a valid letter");
- }
- else
- {
- if (coin == 0) { Console.WriteLine("You lose mofo. The coin was heads!"); }
- if (coin == 1) { Console.WriteLine("You lose mofo. The coin was tails!"); }
- }
- Console.ReadLine();
- //Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement