コード例 #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)
        {
            Set obj1 = new Set();
            Set obj2 = new Set();

            Set.Owner alina = new Set.Owner();
            Set.Date  day   = new Set.Date();

            MathOperation.GetInfo(obj1.Mas);
            MathOperation.Min(obj1.Mas);
            MathOperation.Max(obj1.Mas);
            MathOperation.Length(obj1.Mas);
            MathOperation.Sort(obj1.Mas);
            MathOperation.GetInfo(obj1.Mas);

            Console.WriteLine(obj1 < obj2);
            Console.WriteLine(obj1 != obj2);
            Console.WriteLine(obj1 << 2);
            MathOperation.GetInfo(obj1.Mas);
            Console.WriteLine(obj1 % obj2);
            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Polkovnik-Daniil/folawor
        static void Main(string[] args)
        {
            Set arr1 = new Set(10);
            Set arr2 = new Set(10);

            string[] str1 = new string[] { "lorem", "ipsum", "dolor", "consectetur", "sit", "amet", "adipiscing", "elit", "sed", "do" };
            for (int i = 0; i < arr1.Count; i++)
            {
                arr1[i] = str1[i];
            }

            string[] str2 = new string[] { "diam", "vulputate", "ut", "pharetra", "sit", "amet", "aliquam", "id", "diam", "maecenas" };
            for (int i = 0; i < arr2.Count; i++)
            {
                arr2[i] = str2[i];
            }

            Console.Write("Set 1:");
            arr1.Print();
            Console.Write("Set 2:");
            arr2.Print();

            Console.WriteLine();
            Set arr3 = arr1 - "sit";

            Console.Write("First set - 'sit':");
            arr3.Print();

            Console.WriteLine();
            Set arr4 = arr2 + "sit";

            Console.Write("Second set + 'sit':");
            arr4.Print();

            Console.WriteLine();
            Set arr5 = arr1 % arr2;

            Console.Write("Intersection of 1 and 2 sets:");
            arr5.Print();

            Console.WriteLine();
            Set  arr1copy = arr1;
            bool check;

            check = arr1 != arr2;
            Console.Write("Is 1 and 2 sets inequal? ");
            Console.WriteLine(check);
            check = arr1 != arr1copy;
            Console.Write("Is 1 and 1 copy sets inequal? ");
            Console.WriteLine(check);

            Console.WriteLine();
            string str = SetCheck.minStr(arr2);

            Console.Write("The shortest word in 2 set: ");
            Console.WriteLine(str);

            Console.WriteLine();
            Set arr6 = SetCheck.ordering(arr1);

            Console.Write("Ordered set 1:");
            arr6.Print();

            Console.WriteLine();
            Set.Owner vlad = new Set.Owner();
            vlad.Print();

            Console.WriteLine();
            Set.Date date = new Set.Date();
            date.Print();
        }