Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string    test1 = "The implementation done with integers";
            string    test2 = "the implementation done with characters";
            const int ONE   = 1;
            const int TWO   = 2;
            const int THREE = 3;
            const int FOUR  = 4;
            const int FIVE  = 5;

            const char SONE   = '1';
            const char STWO   = '2';
            const char STHREE = '3';
            const char SFOUR  = '4';
            const char SFIVE  = '5';



            int size   = 0;
            int choice = 0;

            Queue <int>   q   = new Queue <int>();
            MyQueue <int> mq  = new MyQueue <int>(ref q);
            List <int>    lst = new List <int>();

            Queue <char>   s    = new Queue <char>();
            MyQueue <char> sq   = new MyQueue <char>(ref s);
            List <char>    slst = new List <char>();


            mq.Add(ONE);
            mq.Add(TWO);
            lst.Add(THREE);
            mq.ChangeImpl(ref lst);
            mq.Add(FOUR);
            mq.Add(FIVE);

            Console.WriteLine("{0}", test1);

            size = mq.size();

            for (int i = 0; i < size; i++)
            {
                Console.Write("{0}", mq.Get());
                mq.Remove();
            }

            mq.Clear();
            Console.WriteLine();
            Console.WriteLine("{0}", test2);

            sq.Add(SONE);
            sq.Add(STWO);
            slst.Add(STHREE);
            sq.ChangeImpl(ref slst);
            sq.Add(SFOUR);
            sq.Add(SFIVE);

            size = sq.size();

            for (int i = 0; i < size; i++)
            {
                Console.Write("{0}", sq.Get());
                sq.Remove();
            }

            sq.Clear();

            Console.WriteLine();
            Console.ReadLine();
        }   // end main