Exemplo n.º 1
0
        static void Main()
        {
            Console.Write("Enter x size of the 2 arrays to be created: ");
            int xRef = int.Parse(Console.ReadLine());

            Console.Write("Enter y size of 2 arrays to be created: ");
            int             yRef             = int.Parse(Console.ReadLine());
            ObjectInputData TheObjectCreated = new ObjectInputData(xRef, yRef);

            ObjectInputData The2ndObjectCreated = new ObjectInputData(xRef, yRef);

            Console.WriteLine("Enter X index value to search in both arrays: ");
            int xCheck = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter Y index value to search in both arrays: ");
            int yCheck = Convert.ToInt32(Console.ReadLine());


            if (xCheck > -1 && xCheck <xRef& yCheck> -1 && yCheck < yRef)
            {
                Console.WriteLine($"Data in array 1 at location [{xCheck}, {yCheck}] is :{TheObjectCreated.InternalArray[xCheck, yCheck]}");
                Console.WriteLine($"Data in array 2 at location [{xCheck}, {yCheck}] is :{The2ndObjectCreated.InternalArray[xCheck, yCheck]}");
            }
            else
            {
                Console.WriteLine("Invalid input");
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            Console.Write("Enter x value of array: ");
            int xRef = int.Parse(Console.ReadLine());

            Console.Write("Enter y value of array: ");
            int             yRef             = int.Parse(Console.ReadLine());
            ObjectInputData TheObjectCreated = new ObjectInputData(xRef, yRef);

            //how do you reference/output a specified value in the array created in the object TheObjectCreated from Main()?
            //I am wanting to add the feature of typing in index number to search for data in array. For instance, x value of 2
            //& index number y value of 3 (assuming not out of bounds defined by user) yields the contents of array[2,3] from TheObjectCreated
            //In other words, be able to output the data in any given "cell" defined by x and y in any object created under class ObjectInputData "blueprint".
        }