Пример #1
0
 private static void Addding(AddCollection addCollection, int n, string[] elements)
 {
     for (int i = 0; i < n; i++)
     {
         Console.Write(addCollection.AddElement(elements[i]) + " ");
     }
 }
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine()
                             .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            AddCollection       addCollection       = new AddCollection();
            AddRemoveCollection addRemoveCollection = new AddRemoveCollection();
            MyList myList = new MyList();

            foreach (var element in input)
            {
                addCollection.AddElement(element);
            }

            Console.WriteLine();

            foreach (var element in input)
            {
                addRemoveCollection.AddElement(element);
            }

            Console.WriteLine();

            foreach (var element in input)
            {
                myList.AddElement(element);
            }

            Console.WriteLine();

            int countToRemove = int.Parse(Console.ReadLine());

            for (int i = 0; i < countToRemove; i++)
            {
                addRemoveCollection.RemoveElement();
            }

            Console.WriteLine();

            for (int i = 0; i < countToRemove; i++)
            {
                myList.RemoveElement();
            }

            Console.WriteLine();
        }