Advertisement
callumbinner22

Scheme 3 Task 1

Feb 16th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication56
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             bool flag = true;
  14.             while (flag)
  15.             {
  16.                 Console.WriteLine("Please enter which di you would like to use");
  17.                 int dice = Convert.ToInt32(Console.ReadLine());
  18.  
  19.                 if (dice == 4)
  20.                 {
  21.                     Console.WriteLine("You have chosen to use the 4 sided dice");
  22.                     Random rnd = new Random();
  23.                     int number = rnd.Next(1, 5);
  24.                     Console.WriteLine("Your number is " + number);
  25.                 }
  26.                 if (dice == 6)
  27.                 {
  28.                     Console.WriteLine("You have chosen to use the 6 sided dice");
  29.                     Random rnd = new Random();
  30.                     int number = rnd.Next(1, 7);
  31.                     Console.WriteLine("Your number is " + number);
  32.                 }
  33.                 if (dice == 12)
  34.                 {
  35.                     Console.WriteLine("You have chosen to use the 12 sided dice");
  36.                     Random rnd = new Random();
  37.                     int number = rnd.Next(1, 13);
  38.                     Console.WriteLine("Your number is " + number);
  39.                 }
  40.                 Console.WriteLine("Do you want to role again?");
  41.                 String decision = Console.ReadLine();
  42.                 if (decision == "yes")
  43.                 {
  44.                     flag = true;
  45.                 }
  46.                 else
  47.                 {
  48.                     flag = false;
  49.                 }
  50.             }
  51.            
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement