Beispiel #1
0
        static void Main(string[] args)
        {
            MyArray A = new MyArray(5);

            A.ManualFill();
            A.PrintArray();
            MyMatrix B = new MyMatrix(3, 4);

            B.PrintMatrix();
            Console.WriteLine($"Max num {MaxElemArrayMatrix(A, B)}");
            Console.WriteLine($"Min num {MinElemArrayMatrix(A, B)}");
            Console.WriteLine($"Total sum {TotalSumArrayMatrix(A, B)}");
            Console.WriteLine($"Total product of numbers {TotalProductArrayMatrix(A, B)}");
            Console.WriteLine($"Sum of even numbers {A.SumEvenNum()}");
            Console.WriteLine($"Sum of odd columns {B.SumOddColumnElem()}");

            MyArray first = new MyArray(10);

            first.RandomFill();
            MyArray second = new MyArray(20);

            second.RandomFill();
            MyArray third = CreateArrayFromSameNums(first, second);

            Console.WriteLine("\n\nFirst array:");
            first.PrintArray();
            Console.WriteLine("Second array:");
            second.PrintArray();
            Console.WriteLine("Result array:");
            third.PrintArray();

            Console.WriteLine("\nMatrix 5x5 from -100 to 100:\n");
            int[,] matrix = new int[5, 5];
            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    matrix[i, j] = MyArray.rand.Next(-100, 100);
                    Console.Write($"{matrix[i, j]} ");
                }
                Console.Write("\n");
            }
            Console.Write("\n\n");
            Console.WriteLine($"Sum between min and max values {SumMinMaxMatrix(ref matrix)}\n");
        }
Beispiel #2
0
 static double TotalProductArrayMatrix(MyArray a, MyMatrix b)
 {
     return(a.TotalProduct() * b.TotalProduct());
 }
Beispiel #3
0
 static double TotalSumArrayMatrix(MyArray a, MyMatrix b)
 {
     return(a.TotalSum() + b.TotalSum());
 }