Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c please please asap Exercise 2 - Implement a function named rand matrix with the following header void randmatrix (int [][8], int size) -

in c please please asap
image text in transcribed
image text in transcribed
image text in transcribed
Exercise 2 - Implement a function named rand matrix with the following header void randmatrix (int [][8], int size) - The function should fill the 2- dimensional array named with random integer values in the range 20 to 80 (inclusive) Implement a function named matrixprocessing with the following header: void matrix processing (int first[] [8], int second[] [8], int sizel, int size2) Where - sizel is the number of rows of the first 2-dimensional array - size2 is the number of rows of the second 2-dimensional array - The function should find and print each value that exists in the second 2dimensional array that does not exist in the first 2-dimensional array Implement the main function that performs the following: - Defines an integer 2D arrays a of size 98 - Defines an integer 2D arrays b of size 7 X 8 Uses the function rand matrix defined above to randomly initialize the array a. - Uses the function rand_matrix defined above to randomly initialize the array b. - Properly calls the function matrixprocessing to find and print each value that exists in the array b that does not exist in the array a. Problem Description Write a C program to do the following: 1. Define a function named merge that takes as arguments a. Two arrays of integers b. The sizes of each array (not necessarily the same) c. A third array of integers named results The function should merge the contents of the first two arrays into the third array such that the third array will contain all the elements of the other two arrays sorted in descending order. 2. Define a function named add that receives an array of integers and its size. Also, this function must reccive an integer variable representing the value to be added to array. The function must do the following: a. Search the array to make sure the value to be added does not already exist in the array. If the value does not exist it must be added in the first empty position in the array. If the value is found in the array the function prints "value already exists" to the screen. Note: a position is considered empty if its value is - 1 b. If the array is full the function prints to the screen "Array is Full" 3. Define a function named Remove that receives an array and its size along with the value to be removed. The function must do the following: a. Search if the value to be removed exists in the array or not. If the value is not found, print to the screen "value not found". b. If the value is found it must be removed by shifting all the elements in the array to the left by one position. c. Make sure that any empty positions has the value -1 4. In main function do the following: a. Define two arrays of type integer each of size 7. b. Fill the arrays based on values entered from the user. Enter - 1 to indicate that this location is empty when the number of elements is smaller than the array size. c. Define a third array named result of type integer of size 20. d. Merge the two arrays into the array result using the function merge. e. Print the merged array. f. Read a value from the user and add it to the second array you defined. g. Read a value from the user and remove it from the second array you defined. h. Read a value from the user and add it to the second array you defined. i. Print the second array you defined Sample Run Sample Run Please enter the elements for array 1 367101211 Please enter the elements for array 2 24589121 The merged array is 12,12,10,9,8,7,6,5,4,3,2,1,1,1,1,1,1,1,1,1 Enter a value to add to array 2 5 value already exists Enter a value to remove from array 2 4 Enter a value to add to array 2 6 2,5,8,9,12,6,1

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

Students also viewed these Databases questions

Question

=+What virtue?

Answered: 1 week ago