Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var stack = new LinkedStack <int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            Console.WriteLine(String.Join(", ", stack.ToArray()));
        }
Exemplo n.º 2
0
        public static void Main()
        {
            var stack = new LinkedStack <int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            stack.Push(4);
            stack.Push(5);
            stack.Push(6);

            Console.WriteLine(string.Join(", ", stack.ToArray()));

            var r = stack.Pop();

            Console.WriteLine(r);
            Console.WriteLine(string.Join(", ", stack.ToArray()));

            r = stack.Pop();
            Console.WriteLine(r);
            Console.WriteLine(string.Join(", ", stack.ToArray()));
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            LinkedStack <int> stack = new LinkedStack <int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            stack.Push(4);
            stack.Push(5);

            Console.WriteLine("POP " + stack.Pop());

            foreach (var i in stack.ToArray())
            {
                Console.WriteLine(i);
            }
        }