static void Main(string[] args)
        {
            //Create a GameQueue object
            GameQueue newQueue = new GameQueue();

            //Populate the Queue object with 12 new strings of players,
            //using the Enqueue method to add each item to the end of the list

            //Fun Fact: These are actually me and my friends gamer tags
            newQueue.Enqueue("gamerjames");                     //1
            newQueue.Enqueue("JcTheToaster");                   //2
            newQueue.Enqueue("NightmareEra");                   //3
            newQueue.Enqueue("Omega0322");                      //4
            newQueue.Enqueue("Beta Hoofed");                    //5
            newQueue.Enqueue("gregsauce236");                   //6
            newQueue.Enqueue("iiTroglodyte");                   //7
            newQueue.Enqueue("LegacyxMFrog");                   //8
            newQueue.Enqueue("PhantomEra");                     //9
            newQueue.Enqueue("TheQueenWolf");                   //10
            newQueue.Enqueue("RAZORTOOTH0208");                 //11
            newQueue.Enqueue("Twilight Purity");                //12

            //State the current amount of strings in the GameQueue object
            Console.WriteLine("Current players in queue : " + newQueue.Count);

            //Uses the Peek method to see the first item without removing it
            Console.WriteLine("Queue Peek : " + newQueue.Peek() + "\n");

            //Activate a Dequeue method for each object in the newQueue object until it's empty
            while (newQueue.Count != 0)
            {
                //Unlike a stack that prints and removes the latest item added to it,
                //A queue will print and remove the first item added,
                //esentially working opposite to how a stack would
                Console.WriteLine("Player '" + newQueue.Dequeue() + "' has joined the server : "
                                  + newQueue.Count + " player(s) left in queue");
            }

            //Confirm no players left in the queue
            Console.WriteLine("\nCurrent players in queue : " + newQueue.Count + "\n");
            Console.WriteLine("Beginning Team Deathmatch...");
        }
示例#2
0
        static void Main(string[] args)
        {
            GameQueue newQueue = new GameQueue(new string[0]);

            newQueue.Enqueue("Bob");
            newQueue.Enqueue("Jack");
            newQueue.Enqueue("Fudge");
            newQueue.Enqueue("Gavvy");
            newQueue.Enqueue("Wavvy");
            newQueue.Enqueue("BobAgain");
            newQueue.Enqueue("Creativity");
            newQueue.Enqueue("None");
            newQueue.Enqueue("NoMorePLS");
            newQueue.Enqueue("OkGood");
            newQueue.Enqueue("abfkjsd");
            while (newQueue.IsEmpty == false)
            {
                Console.WriteLine(newQueue.Dequeue());
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            GameQueue queue = new GameQueue(12);

            queue.Enqueue("Bob");
            queue.Enqueue("Jim");
            queue.Enqueue("Fred");
            queue.Enqueue("Tim");
            queue.Enqueue("Alex");
            queue.Enqueue("Ted");
            queue.Enqueue("Noah");
            queue.Enqueue("Blake");
            queue.Enqueue("Mark");
            queue.Enqueue("Will");
            queue.Enqueue("Chad");
            queue.Enqueue("Liam");

            while (!queue.IsEmpty)
            {
                Console.WriteLine("Player " + queue.Dequeue() + " has joined the server: " + queue.Count + " player(s) left in the queue");
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            GameQueue gq = new GameQueue();
            string    player;

            gq.Enqueue("DafriendOrDafoe");
            gq.Enqueue("FoofieCake");
            gq.Enqueue("OldSchoolZinger");
            gq.Enqueue("hunterkiller223");
            gq.Enqueue("Fripberries");
            gq.Enqueue("Lancer2586");
            gq.Enqueue("J0ker5150");
            gq.Enqueue("fallenMTK");
            gq.Enqueue("LennoxMcGee");
            gq.Enqueue("JoshTheArty504");
            gq.Enqueue("L1z4rd$q4d");

            while (gq.IsEmpty == false)
            {
                player = gq.Dequeue();
                Console.WriteLine("Player '" + player + "' has joined the server: " + gq.Count + " player(s) left in queue");
            }
        }