Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c please asap Problem Description Write a C program to do the following: 1. Define a function named merge that takes as arguments a.

in c please asap
image text in transcribed
image text in transcribed
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 receive 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 cmpty 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 Please enter the elements for array 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 Please enter the elements for array 1 367101211

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_2

Step: 3

blur-text-image_3

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

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago