Question: Ask the user to insert how many array elements that they desired, maximum 2 0 . 2 . Create three arrays ( array 1 ,

Ask the user to insert how many array elements that they desired, maximum 20.
2. Create three arrays (array1, array2, array3) with each of them have the total number of elements that inserted by user.
3. Generate a random number for each element in the first two arrays (array1 & array2) within the range of 0 to 10,000.
Hints: You could explore srand() and rand() to generate the random number.
4. For the first two arrays (array1 & array2), compare element by element. If the element value of array1 is larger than array2, then store 1 in the array3 element accordingly. If the element value of array1 is smaller than array2, then store 2 in the array3 element accordingly. If the element of array1 and array2 are equal, then store 0 in the array3.
5. From array3 which only stores 1,2 or 0 based on the comparison result of each element stores in the array1 and array2, determine:
The total number of elements that array1 is larger than array2.
The total number of elements that array2 is larger than array1.
The total number of elements that array1 is equal with

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!