Пример #1
0
        static void Main(string[] args)
        {
            StackOfStrings SOS = new StackOfStrings();

            SOS.Push("hello");
            SOS.Push("How");
            SOS.Push("r");
            SOS.Push("u");
            Console.WriteLine(SOS.IsEmpty());
            Console.WriteLine(SOS.Pop());
            Console.WriteLine(SOS.Peek());
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            StackOfStrings myStack = new StackOfStrings();

            Console.WriteLine("Does the stack starts empty? {0}", myStack.IsEmpty());
            myStack.Push("first");
            myStack.Push("second");
            Console.WriteLine("Is it empty after pushing two values? {0}", myStack.IsEmpty());

            Console.WriteLine("poped value: {0}", myStack.Pop());
            myStack.Push("third");
            Console.WriteLine("peek value: {0}", myStack.Peek());
            Console.WriteLine("poped value: {0}", myStack.Pop());
            Console.WriteLine("poped value: {0}", myStack.Pop());
        }