Answered step by step
Verified Expert Solution
Link Copied!

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 ++

  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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

What is order of reaction? Explain with example?

Answered: 1 week ago

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago