示例#1
0
    static void Main(string[] args)
    {
        var stack = new StackWithArray(10);

        stack.Push("sej");
        stack.Push("er");
        stack.Push("Nicolai");

        Console.WriteLine($"Top: {stack.Top}");

        stack.ToggleTop();

        Console.WriteLine("Running ToggleTop()...");

        Console.WriteLine($"Top: {stack.Top}");

        stack.ToggleTop();

        Console.WriteLine("Running ToggleTop()...");

        Console.WriteLine($"Top: {stack.Top}");

        Console.WriteLine("Emptying stack...");
        while (!stack.Empty)
        {
            Console.WriteLine(stack.Top);

            stack.Pop();
        }

        Console.ReadLine();
    }