fork download
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5. class Roadtrip
  6. {
  7. public static void Main()
  8. {
  9. Queue<string> musicCollection = new Queue<string>();
  10.  
  11. musicCollection.Enqueue ("All You Need is Love");
  12. musicCollection.Enqueue ("Ain't Going Down Til the Sun Comes Up");
  13. musicCollection.Enqueue ("She's Always a Woman to Me");
  14. musicCollection.Enqueue ("Single Ladies (Put a Ring on It)");
  15. musicCollection.Enqueue ("Rolling in the Deep");
  16. musicCollection.Enqueue ("Family Tradition");
  17. musicCollection.Enqueue ("Margaritaville");
  18.  
  19. // Print the music in my Queue
  20. Console.WriteLine("Here are the songs for the road trip:");
  21. foreach (string music in musicCollection)
  22. {
  23. Console.WriteLine(music);
  24. }
  25.  
  26. //After finishing the first song, I want to remove it from the queue
  27. musicCollection.Dequeue ();
  28.  
  29.  
  30.  
  31. Console.WriteLine("\nThe remaining songs for the roadtrip are:");
  32. foreach (string music in musicCollection)
  33. {
  34. Console.WriteLine(music);
  35. }
  36.  
  37. }
  38. }
Success #stdin #stdout 0.03s 15916KB
stdin
Standard input is empty
stdout
Here are the songs for the road trip:
All You Need is Love
Ain't Going Down Til the Sun Comes Up
She's Always a Woman to Me
Single Ladies (Put a Ring on It)
Rolling in the Deep
Family Tradition
Margaritaville

The remaining songs for the roadtrip are:
Ain't Going Down Til the Sun Comes Up
She's Always a Woman to Me
Single Ladies (Put a Ring on It)
Rolling in the Deep
Family Tradition
Margaritaville