Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 ++
- Create a new project with the name Lab1_Arrays. Inside this project, create a file with the name ArrayExercises.
- 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.
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started