Question: in C ++ Create a new project with the name Lab1_Arrays. Inside this project, create a file with the name ArrayExercises. In ArrayExercises file create

in C ++

  1. Create a new project with the name Lab1_Arrays. Inside this project, create a file with the name ArrayExercises.
  2. In ArrayExercises file create the following methods:
    • fillArray_1D() method, to initialize the 1D array with random values (between 0 and 99)
    • fillArray_2D() method, to initialize the 2-D array with random values (between 0 and 99). For the sake of simplicity, assume the 2D array size is always [3][3].
    • printArray_1D () method, to display 1D array. printArray_2D () method to display 2D array.
    • belowAboveAvg () method which first finds the average of all random numbers entered in 1D array and then finds and displays the number of elements less than and greater than the average.
    • swapLargestSmallest() method which swaps the largest and smallest elements in the 1D array.
    • sumRowsColumns () method which finds and displays the sum of each row and each column of the 2D array.
    • repeatedElementsRow () method which displays row(s) which contain(s) repeated elements in 2D array.
  3. In the main () method:
    • Ask the user to enter the number of elements in 1D array.
    • Create test1D Array:int test1D[noOflements] ;
    • Fill the elements in the test1D array, by calling fillArray_1D(test) method.
    • Task1: Finds the average of all random numbers entered in 1D array and then finds and displays the number of elements less than and greater than the average, by calling belowAboveAvg () method.
    • Task2: Swaps largest and smallest elements in the 1D array,swapLargestSmallest () method. Create test2D Array, and assume in all related functions the following size: int test2D [3][4];
    • Fill the elements in the test2D array, by calling fillArray_2D(test2D) method.
    • Task3: Finds and displays the sum of each row and each column of the 2D array., by calling SumRowsColumns() method.
    • Task4: Displays row(s) which contain(s) repeated elements in 2D array, by calling repeatedElementsRow() method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!