Advertisement
callumbinner22

Queues Task 3

Dec 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.43 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApplication50
  9. {
  10.     class Program
  11.     {
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.             Queue<string> prizes = new Queue<string>();
  16.  
  17.  
  18.  
  19.  
  20.             prizes.Enqueue("Trip to Summer Camp in Poland");
  21.             prizes.Enqueue("Cuddly Bear");
  22.             prizes.Enqueue("Random celebrity as a butler");
  23.             prizes.Enqueue("All inclusive trip to shutdown disneyland UAE");
  24.             prizes.Enqueue("£5000");
  25.  
  26.             foreach (string item in prizes)
  27.             {
  28.                 Console.WriteLine(item);
  29.             }
  30.             Console.WriteLine("");
  31.             Console.WriteLine("");
  32.             Console.WriteLine("");
  33.             Console.WriteLine("After 5 seconds press enter!");
  34.             string ready = Console.ReadLine();
  35.  
  36.  
  37.             Console.Clear();
  38.  
  39.  
  40.             Console.WriteLine("What is the first prize?");
  41.             string first = Console.ReadLine();
  42.             if (prizes.Peek().Equals(first))
  43.             {
  44.                 Console.WriteLine("Correct!!");
  45.                 prizes.Dequeue();
  46.  
  47.             }
  48.  
  49.             Console.WriteLine("What is the second prize?");
  50.             string second = Console.ReadLine();
  51.             if (prizes.Peek().Equals(second))
  52.             {
  53.                 Console.WriteLine("Correct!!");
  54.                 prizes.Dequeue();
  55.  
  56.             }
  57.             Console.WriteLine("What is the third prize?");
  58.             string third = Console.ReadLine();
  59.             if (prizes.Peek().Equals(third))
  60.             {
  61.                 Console.WriteLine("Correct!!");
  62.                 prizes.Dequeue();
  63.  
  64.             }
  65.             Console.WriteLine("What is the fourth prize?");
  66.             string fourth = Console.ReadLine();
  67.             if (prizes.Peek().Equals(fourth))
  68.             {
  69.                 Console.WriteLine("Correct!!");
  70.                 prizes.Dequeue();
  71.  
  72.             }
  73.             Console.WriteLine("What is the fifth prize?");
  74.             string fifth = Console.ReadLine();
  75.             if (prizes.Peek().Equals(fifth))
  76.             {
  77.                 Console.WriteLine("Correct!!");
  78.                 prizes.Dequeue();
  79.  
  80.             }
  81.             else
  82.             {
  83.                 Console.WriteLine("Wrong! You lose!");
  84.             }
  85.  
  86.             }
  87.         }
  88.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement