Beispiel #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            //S.Push("4");
            //Console.WriteLine("stack");
            //Console.WriteLine("Bạn đã lấy và xóa phần tử {0}", S.Pop());
            //Console.WriteLine("số lượng phần tử trong danh sách {0}", S.Count());
            //Console.WriteLine("=======================================");
            //MyQueue Q = new MyQueue();
            //Q.Enqueue(1);
            //Q.Enqueue(2);
            //Q.Enqueue(3);

            //Console.WriteLine("Queue");
            //Console.WriteLine("Bạn đã lấy và xóa phần tử {0}", Q.Dequeue());
            //Console.WriteLine("Bạn đã lấy và xóa phần tử {0}", Q.Dequeue());
            //Console.WriteLine("số lượng phần tử trong danh sách {0}", Q.count);

            string[] array = { "Mr", "Pham", "Ngoc", "Duy" };



            MyStack S = new MyStack(array.Length);

            for (int z = 0; z < array.Length; z++)
            {
                S.Push(array[z]);
            }
            for (int j = 0; j < array.Length; j++)
            {
                array[j] = S.Pop();
            }


            for (int i = 0; i < array.Length; i++)
            {
                Console.WriteLine(array[i] + " ");
            }

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //DynamicArray arr = new DynamicArray(10);
            //arr.CreateRandomMassive();
            //arr.printMassive();
            //
            //Console.WriteLine(arr.Pop(0));
            //arr.printMassive();
            //
            //arr.PushBack(12);
            //arr.printMassive();
            //
            //arr.Insert(8, 44);
            //arr.printMassive();
            //
            //arr.Delete(8);
            //arr.printMassive();

/////////////////////////////////////////////////////////////////////////////////////////////
            MyStack two = new MyStack();

            two.Push(500);
            two.PrintMyStack();

            Console.WriteLine(two.Pop());
/////////////////////////////////////////////////////////////////////////////////////////////
            MyQueue free = new MyQueue();

            free.Push(220);
            free.Push(220);
            free.Push(300);
            free.Pop();
            free.PrintMyQueue();

            Console.WriteLine(free.Pop());
        }