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 CodeKicker.BBCode;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string userResponse;
- int die1, die2;
- const int MAXROLL = 6;
- do
- {
- Console.WriteLine("Do you want to roll the dice?");
- Console.WriteLine("Please enter Yes or No");
- userResponse = Console.ReadLine();
- if (userResponse.ToUpper() == "YES")
- {
- Random randomNums = new Random();
- die1 = randomNums.Next(1, MAXROLL + 1);
- die2 = randomNums.Next(1, MAXROLL + 1);
- Console.WriteLine("You rolled {0} and {1}", die1, die2);
- if (die1 == MAXROLL && die2 == MAXROLL)
- {
- Console.WriteLine("You rolled Boxcars!");
- }
- if (die1 == 1 && die2 == 1)
- {
- Console.WriteLine("You rolled Snake-eyes!");
- }
- }
- else if (userResponse.ToUpper() != "NO")
- {
- Console.WriteLine("You must answer YES or NO.");
- }
- Console.WriteLine();
- } while (userResponse.ToUpper() != "NO");
- Console.WriteLine("Goodbye");
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment