fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class SomeBooks
  5. {
  6. public static void Main()
  7. {
  8. // Queue<string> colBestSellers = new Queue<string>();
  9.  
  10. // Console.WriteLine("Adding Books to my Collection.");
  11. // colBestSellers.Enqueue ("The Heist: A Novel (Gabriel Allon)");
  12. // colBestSellers.Enqueue ("The Book of Life: A Novel (All Souls Trilogy)");
  13. // colBestSellers.Enqueue ("Tom Clancy Support and Defend (A Campus Novel)");
  14. // colBestSellers.Enqueue ("A Prefect Life: A Novel");
  15. // colBestSellers.Enqueue ("The Goldfinch: A Novel");
  16.  
  17. // Console.WriteLine("\nDumping All Books from Collection");
  18. // foreach (string appName in colBestSellers)
  19. // {
  20. // Console.WriteLine(" " + appName);
  21. // }
  22.  
  23. // Console.WriteLine("\nRemoving Two Items from Queue");
  24. // colBestSellers.Dequeue();
  25. // colBestSellers.Dequeue();
  26.  
  27. // Console.WriteLine("\nDumping All Books from Collection");
  28. // foreach (string appName in colBestSellers)
  29. // {
  30. // Console.WriteLine(" " + appName);
  31. // }
  32.  
  33. // Console.WriteLine("\nAdding three new items to my book collection");
  34. // colBestSellers.Enqueue ("Act of War: A Thriller");
  35. // colBestSellers.Enqueue ("The Silkworm (A Cormoran Strike Novel)");
  36. // colBestSellers.Enqueue ("Invisible");
  37.  
  38. // Console.WriteLine("\nDumping All Books from Collection");
  39. // foreach (string appName in colBestSellers)
  40. // {
  41. // Console.WriteLine(" " + appName);
  42. // }
  43.  
  44. // Console.WriteLine("")
  45.  
  46. Stack stkBestSellers = new Stack();
  47. stkBestSellers.Push ("The Heist: A Novel (Gabriel Allon)");
  48. stkBestSellers.Push ("The Book of Life: A Novel (All Souls Trilogy)");
  49. stkBestSellers.Push ("Tom Clancy Support and Defend (A Campus Novel)");
  50. stkBestSellers.Push ("A Prefect Life: A Novel");
  51. stkBestSellers.Push ("The Goldfinch: A Novel");
  52.  
  53. Console.WriteLine("My stack of books contains:");
  54.  
  55. foreach(string bookName in stkBestSellers) {
  56. Console.WriteLine(" " + bookName);
  57. }
  58.  
  59. // Console.WriteLine("Just got a copy of SnagIt 12! Let's get Pop SnagIt 11");
  60. // stkBestSellers.Pop();
  61.  
  62. // Console.WriteLine("And let's Push SnagIt 12 in there...");
  63. // stkBestSellers.Push("TechSmith SnagIt 12");
  64. // Console.WriteLine("\n");
  65.  
  66. // Console.WriteLine("Do I still have LINQPad 4 Installed? ... " + stkBestSellers.Contains("LINQPad 4") + "\n");
  67.  
  68. // Console.WriteLine("Let's pop through the stack:");
  69.  
  70. // while(stkBestSellers.Count > 0) {
  71. // string appPop = (string) stkBestSellers.Pop ();
  72. // Console.WriteLine("Popping {0}", appPop );
  73. // }
  74. // Console.WriteLine("\n");
  75.  
  76. // Console.WriteLine("And finally, let's make sure we're completely clean by issuing a clear.");
  77. // stkBestSellers.Clear();
  78.  
  79.  
  80. }
  81. }
Compilation error #stdin compilation error #stdout 0.03s 33880KB
stdin
Standard input is empty
compilation info
prog.cs(46,13): error CS0305: Using the generic type `System.Collections.Generic.Stack<T>' requires `1' type argument(s)
/usr/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll (Location of the symbol related to previous error)
prog.cs(47,17): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
prog.cs(48,9): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
prog.cs(49,9): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
prog.cs(50,9): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
prog.cs(51,9): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
prog.cs(55,44): error CS0841: A local variable `stkBestSellers' cannot be used before it is declared
Compilation failed: 7 error(s), 0 warnings
stdout
Standard output is empty