Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

slove all of these using C language ate a new project. Use this project to create A function named rand_array that takes as argument an

slove all of these using C language
image text in transcribed
image text in transcribed
image text in transcribed
ate a new project. Use this project to create A function named rand_array that takes as argument an array of integers and its size. The function should initialize the array elements with random values between 5 and 5 (inclusive) - A function named process_array that takes as argument an array of integers and its size, the function returns how many elements in the array larger than 0 Create a program that - prompts the user to enter an integer N - creates an array of integers of size N - uses rand_array function to initialize the array with random values. - uses process_array to count how many elements in the first half of the array appears in the second half of the array - Print the count result. Write a C program to do the following: 1. Define a function named merge that takes as arguments a. Two arrays of sorted integers (in ascending order) 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 ascending order. Page 1 of 3 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. b. If the value does not exist, it must be added in the first empty position in the array (a position is considered empty if its value is 0 (zero)) c. If the value is found in the array the function prints "value aiready exists" to the screen. d. 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 returned at the end of the function. c. Shift all the elements in the array to the left by one position so that all the filled values are consecutive. d. Make sure that any empty position has the value 0 4. In main function do the following: a. Define two arrays of type integer each of ste 5. b. Fill in the arrays based on values entered by the user. A o should be entered if no more elements are going to be added (Look at sample). c. Define a third array named result of type integer each of size 15. 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 first array you defined. g. Read a value from the user and remove it from the first array you defined. h. Print the first array you defined Implement a function named rand_matrix with the following header voidrandmatrix(intmx[][9],intsize) - The function should fill the 2-dimensional array named mrx with random integer values in the range 2 to 100 (inclusive) Implement a function named matrix_processing with the following header void matrix processing (int first[][9], int second[][9], int sizelsidat size2) - size1 is the number of rows of the first 2-dimensional array - size 2 is the number of rows of the second 2-dimensional array - The function should find and print each value that exists in the first 2-dimensional array that does not exist in the second 2-dimensional array - Implement the main function that performs the following: Defines an integer 2D array a of size 109 Defines an integer 2D array b of size 69 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 matrix_processing to find and print each value that exists in the array a that does not exist in the array b

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

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions