예제 #1
0
        public static void TestStack()
        {
            Console.WriteLine("Testing stack operations!\n");

            MyStack <int> stack = new MyStack <int>();

            stack.Push(10);
            Console.WriteLine(stack.Pop());
            stack.Push(20);
            stack.Push(25);
            Console.WriteLine(stack.Pop());
            Console.WriteLine(stack.Pop());
            try
            {
                Console.WriteLine(stack.Pop());
            }
            catch (Exception)
            {
                Console.WriteLine("Test of deliberate pop on empty stack successful!");
            }
        }
예제 #2
0
 public StackWithMinMethod()
 {
     minStack = new MyStack <T>();
 }