Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Please Question (1) Write a code with the following specifications: In the main function create an array with constant size of 20. (1mark)

image text in transcribed

In C++ Please

Question (1) Write a code with the following specifications: In the main function create an array with constant size of 20. (1mark) Create the following functions: o fill(int a[], int size), the function should fill the array a[] with random numbers between 1-100 ( use rand() function) (2 marks) o min(int a[], int size) return the minimum number in the array (2 marks) o median(int a[], int size) return the median of the numbers in the array (2 marks) o search(int a[], int size, int x) find and return the index of the first appearance of value x in the array. (2 marks) osumEvenindex(int a[], int size) return the sum of the numbers that are in the Even indices in the array. (2 marks) o sort(int a[], int size, int asc) sort the array ascending if asc=1, and descending otherwise. (3 marks) o reverse(int a[], int size) that changes/swap the items in the array to be in reverse order. Example: if a={2,1,7,1,5} then it should become {5,1,7,1,2}. (3 marks) o oddarray (int a[], int size) this function should remove all even values from the array and keeps only the odd numbers. (3 marks) Test all functions in the main. (5 marks) Question (2) What is the difference between call by value, call by reference, and call by address? Provide examples and comments that illustrate the differences

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions