static void Main(string[] args)
        {
            Stack <int> a = new Stack <int>();

            a.Push(645);
            a.Push(145);
            a.Push(479);
            a.Print();
            a.Pop();
            a.Push(5);
            a.Push(64);
            a.Pop();
            Console.WriteLine("Last Element = " a.Peek());
            a.Push(7854);
            a.Push(6);
            a.Push(8264);
            a.Push(1234567);
            a.Print();
        }
示例#2
0
        static void Main(string[] args)
        {
            Stack <int> a = new Stack <int>();

            a.Push(465);
            a.Push(556);
            a.Push(123);
            a.Push(5);
            a.Push(86);
            a.Pop();
            a.Push(79);
            a.Peek();
            a.Print();
            Console.WriteLine(a.Peek());
        }