Beispiel #1
0
        static void Main(string[] args)
        {
            Massiv arr1 = new Massiv(10);

            for (int i = 0; i < arr1.Index; i++)
            {
                arr1[i] = i;
            }
            arr1.Print();
            Console.WriteLine();
            Massiv arr2 = new Massiv(10);

            for (int i = 0; i < arr2.Index; i++)
            {
                arr2[i] = i;
            }
            arr2.Print();
            Console.WriteLine();
            Massiv arr3 = new Massiv(10);

            arr3 = arr1 - arr2;
            arr3.Print();
            Console.WriteLine();
            Massiv arr4 = new Massiv(20);

            arr4 = arr1 + arr2;
            arr4.Print();
            Console.WriteLine();
            int chislo, vhod;

            Console.WriteLine("Введите число");
            chislo = Convert.ToInt32(Console.ReadLine());
            vhod   = arr1 > chislo;
            if (vhod == 0)
            {
                Console.WriteLine("число не входит в arr1");
            }
            else
            {
                Console.WriteLine("число не входит в arr1");
            }
            if (arr1 != arr2)
            {
                Console.WriteLine(" Arr1 != Arr2");
            }
            else
            {
                Console.WriteLine("Arr1 == Arr2");
            }
            string str = "Апельсин";

            Console.WriteLine(str.DeleteVowels());
            Massiv arr5 = new Massiv(15);

            arr5 = arr4.FiveElem();
            arr5.Print();
            Console.ReadLine();
        }
Beispiel #2
0
        public static Massiv FiveElem(this Massiv v)
        {
            Massiv v0 = new Massiv(v.Index - 5);

            for (int i = 0; i < v0.Index; i++)
            {
                v0[i] = v[i + 5];
            }
            return(v0);
        }
Beispiel #3
0
        public static Massiv operator -(Massiv x, Massiv y)
        {
            Massiv temp = new Massiv(x.Index);

            for (int i = 0; i < temp.Index; i++)
            {
                temp[i] = x[i] - y[i];
            }
            return(temp);
        }
Beispiel #4
0
        public static Massiv operator +(Massiv x, Massiv y)
        {
            Massiv temp = new Massiv(x.Index + y.Index);

            for (int i = 0; i < x.Index; i++)
            {
                temp[i] = x[i];
            }
            for (int i = 0; i < y.Index; i++)
            {
                temp[i + x.Index] = y[i];
            }
            return(temp);
        }