Пример #1
0
        static void Main(string[] args)
        {
            Set s1 = new Set(new int[6] {
                1, 5, 3, 54, 4, 43
            });
            Set s2 = new Set(new int[6] {
                10, 5, 33, 7, 2, 82
            });
            Set q1 = new Set(new int[6] {
                1, 2, 3, 4, 5, 6
            });
            Set q2 = new Set(new int[3] {
                2, 3, 4
            });

            for (int i = 0; i < s1.plenty.Length; i++)
            {
                Console.WriteLine($"{s1.plenty[i]}");
            }
            Console.WriteLine("Прибавили в конец массива");
            s1 = s1 + 2;
            for (int i = 0; i < s1.plenty.Length; i++)
            {
                Console.WriteLine($"{s1.plenty[i]}");
            }
            Console.WriteLine("Объединение");
            Set s3 = s1 + s2;

            for (int i = 0; i < s3.plenty.Length; i++)
            {
                Console.WriteLine($"{s3.plenty[i]}");
            }
            Console.WriteLine("Пересечение");
            Set s4 = s1 * s2;

            for (int i = 0; i < s4.plenty.Length; i++)
            {
                Console.WriteLine($"{s4.plenty[i]}");
            }
            Console.WriteLine($"Мощность множества {!s1}");
            Console.WriteLine($"Подмножество множества {q1|q2}");
            Set.Owner owner = new Set.Owner(228, "Grisha", "BSTU");
            Set.Date  date  = new Set.Date(09, 01, 2002);
            Console.WriteLine($"Сумма множества {StatisticOperation.Sum(s1)}");
            Console.WriteLine($"Разница между максимальным и минимальным {StatisticOperation.Maxmin(s1)}");
            string st = "Hello mad world";

            Console.WriteLine($"Вставка запятых {StatisticOperation.After(st)}");
            Console.WriteLine($"Удаление одинаковых ");
            s1.Delete();
            for (int i = 0; i < s1.plenty.Length; i++)
            {
                Console.WriteLine($"{s1.plenty[i]}");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Lists.Owner owner = new Lists.Owner();
            Console.WriteLine("Я: {0} {1} {2}", owner.id, owner.name, owner.organization);

            Lists.Owner.Date time = new Lists.Owner.Date();
            Console.WriteLine(time.date);
            Console.WriteLine();


            Lists Words = new Lists();

            Words.Add("Минск");
            Words.Add("Гродно");
            Words.Add("Витебск");
            Words.Add("Могилев");

            Console.WriteLine("Список:");
            Words.Output();

            Console.WriteLine("Удаление элемента: ");
            Words = Words >> 1;
            Words.Output();

            Console.WriteLine("Добавление элемента в заданную позицию: ");
            Words = Words + 1;
            Words.Output();

            Lists Words2 = new Lists();

            Words2.Add("Минск");
            Words2.Add("Гродно");
            Words2.Add("Витебск");

            Console.WriteLine("Проверка на равенство множеств: ");
            bool eq = Words != Words2;

            if (eq)
            {
                Console.WriteLine("Списки равны");
            }
            else
            {
                Console.WriteLine("Списки не равны");
            }

            StatisticOperation.CountOfElem(Words);
            StatisticOperation.Sum(Words);
            StatisticOperation.Max_Min(Words);

            string i = Words.WordMax();

            Console.WriteLine("Самое длинное слово: " + i);

            Words.DelLast();
            Console.WriteLine("Удаление последнего: ");
            Words.Output();


            Console.ReadKey();
        }