Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            /****  Ques1
             *
             * // creating object using default constructor
             * Numbers nobj1 = new Numbers();
             * nobj1.Accept();
             * nobj1.Display();
             *
             * // Creating object using parametrised Constructor
             * Numbers nobj2 = new Numbers(5);
             * nobj2.Accept();
             * nobj2.Display();
             *
             * // Creating copy of obj2
             * Numbers nobj3 = new Numbers(nobj2);
             * nobj3.Display();
             *
             *****/

            /***** Ques 2
             *
             *
             * // object 1
             * ArrayOperations aobj1 = new ArrayOperations();
             * aobj1.Accept();
             * aobj1.Display();
             * Console.WriteLine($"Maximum Number is : { aobj1.Maximum() }");
             * Console.WriteLine($"Minimum Number is : { aobj1.Minimum() }");
             *
             * // object 2
             * ArrayOperations aobj2 = new ArrayOperations(6);
             * aobj2.Accept();
             * aobj2.Display();
             * Console.WriteLine($"Maximum Number is : { aobj2.Maximum() }");
             * Console.WriteLine($"Minimum Number is : { aobj2.Minimum() }");
             *
             * // object3
             * ArrayOperations aobj3 = new ArrayOperations(aobj2);
             * aobj3.Display();
             * Console.WriteLine($"Maximum Number is : { aobj3.Maximum() }");
             * Console.WriteLine($"Minimum Number is : { aobj3.Minimum() }");
             *
             *****/

            /*** Ques 3
             */

            ArrayCombine acobj1 = new ArrayCombine(5);
            int          no;
            int          iRet;

            acobj1.Accept();
            acobj1.Display();

            // Search
            Console.Write("Enter number that you want to Search: ");
            no   = Convert.ToInt32(Console.ReadLine());
            iRet = acobj1.Search(no);

            if (iRet != -1)
            {
                Console.WriteLine($"Position is : { iRet } ");
            }
            else
            {
                Console.WriteLine("Number is not present in Array");
            }

            // Freaquence
            Console.Write("Enter number that you want to find the Frequence: ");
            no = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine($"Frequence of { no } is : { acobj1.Frequency(no) } ");

            // Summation
            Console.WriteLine($" Summation of all elements in array is : {acobj1.Summation() } ");

            // Average
            Console.WriteLine($" Average of all elements in array is : {acobj1.Average() } ");
        }
Ejemplo n.º 2
0
 public ArrayCombine(ArrayCombine obj) : base(obj)
 {
 }