Example #1
0
        static double MaxElemArrayMatrix(MyArray a, MyMatrix b)
        {
            int    maxInt    = a.FindMax();
            double maxDouble = b.FindMax();

            return(maxInt > maxDouble ? maxInt : maxDouble);;
        }
Example #2
0
        static MyArray CreateArrayFromSameNums(MyArray one, MyArray two)
        {
            int result = 0;
            int max1   = one.FindMax();
            int max2   = two.FindMax();

            int[] arr = new int[max1 > max2 ? max1 : max2];
            for (int i = 0; i < one.GetLength(); ++i)
            {
                for (int j = 0; j < two.GetLength(); ++j)
                {
                    if (one.GetAt(i) == two.GetAt(j))
                    {
                        bool added = false;
                        for (int i1 = 0; i1 < result; ++i1)
                        {
                            if (one.GetAt(i) == arr[i1])
                            {
                                added = true;
                                break;
                            }
                        }
                        if (!added)
                        {
                            arr[result] = one.GetAt(i);
                            ++result;
                        }
                    }
                }
            }

            MyArray third = new MyArray(result);

            for (int i = 0; i < result; ++i)
            {
                third.SetAt(arr[i], i);
            }
            return(third);
        }