Question: 1 . ( 5 0 Points ) A ) ( 1 5 Points ) Define a function int [ ] GetRandom ( int (

1.(50 Points)
A)(15 Points) Define a function int[] GetRandom(int \(\mathbf{N}\), int \(\mathbf{a}\), int \(\mathbf{b}\)) that returns an array of size \(\mathbf{N}\), of which all the elements are random integers between \(\mathbf{a}\) and \(\mathbf{b}\).
B)(15 Points) Define a function int Smallest(int[] Y, ref int pos) that takes an integer array \(\mathbf{Y}\) as input and returns the smallest element in the array. It also uses pass-by-reference to find the index, pos, of the smallest element.
C)(20 Points) Use the functions in A) and B) as part of a C\# Console App program that analyzes a group of random numbers. Here is how it works:
The user is prompted to enter 3 positive integers: How many random numbers, lower bound and upper bound.
Upon receiving valid inputs, your program calls the function in A ) to get all the random numbers accordingly and displays them. It then calls the function in B ) and finds the smallest element and its position.
If any of the user inputs is not valid, your program should display a warning message and allow re-entering until a valid value is entered.
The output of your program could look this:
How many random numbers are there, please? 6
What is the lower bound? 10
What is the upper bound? 90
The random numbers are:
The smallest among them is: 12 at Position\# 3.
1 . ( 5 0 Points ) A ) ( 1 5 Points ) Define a

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 Programming Questions!