Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            StackOfStrings stack = new StackOfStrings();
            ArrayStack arrayStack = new ArrayStack(1);
            string test = "This is - a - test string -";
            string[] words = test.Split(' ');
            foreach (string word in words)
            {
                if (word == "-")
                {
                    Console.Write(stack.pop());
                    Console.Write(" From array stack" + arrayStack.pop());
                }
                else
                {
                    arrayStack.push(word);
                    stack.push(word);
                }

            }
        }