Beispiel #1
0
        static void Main(string[] args)
        {
            List list = new List();

            list.init(new [] { 0, 9 }, 2);
            Console.Write("init list: ");
            list.show();

            list.add(0);
            Console.Write("add 0: ");
            list.show();

            list.remove(0);
            Console.Write("remove 0: ");
            list.show();

            list.remove(0);
            Console.Write("remove 0 again: ");
            list.show();

            list.add(7);
            Console.Write("add 7: ");
            list.show();

            list.add(4);
            Console.Write("add 4: ");
            list.show();

            list.reverse();
            Console.Write("reverse: ");
            list.show();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            List list = new List();

            list.init(new [] { 0, 1, 2, 3, 4, 5 }, 6);
            Console.Write("Initialized list: ");
            list.show();

            list.add(6);
            Console.Write("Added 6: ");
            list.show();

            list.remove(6);
            Console.Write("Removed 6: ");
            list.show();

            list.remove(0);
            Console.Write("Removed 0: ");
            list.show();

            list.remove(3);
            Console.Write("Removed 3: ");
            list.show();

            list.add(7);
            Console.Write("Added 7: ");
            list.show();

            list.reverse();
            Console.Write("Reversed list: ");
            list.show();
        }