Question: Write a program that will do the following: In main, declare an array of size 2 0 and name it randomArray. Use the function in
Write a program that will do the following:
In main, declare an array of size and name it "randomArray." Use the function in step to fill the array. Use the function in step to print the array.
Create a function that generates random integers with a range of to and places them into an array. Reuse the functions from Lab where appropriate.
Make this a function.
There will be two arguments in the parameter list of this function: an array and the size of the array.
Within the function and the function prototype name the array: intArray.
Within the function and the function prototype name the size of the array: size.
The data type of the function will be void since the array will be sent back through the parameter list.
Bring in the function that generates and returns a random number that you created from the previous module. Call that function from this within the loop that adds random numbers to the array.
Display the contents of the array. Recycle the function that prints out the contents of an integer array from Lab
Make this a function.
There will be two arguments in the parameter list of this function: an array and the size of the array.
Within the function and the function prototype name the array: intArray.
Within the function and the function prototype name the size of the array: size.
The data type of the function will be void since the array will be sent back through the parameter list.
From main, generate one more random number also from to from the random number function. Do not put this in an array. This is a stand alone variable that contains one random number.
Search though the array and count how many times the extra random number occurs. It is possible that the extra random number may occur more than once or not at all.
Output:
Display the entire array.
Display the extra random number.
Depending upon the result of your search, display one of the following:
How many times the random number occurs.
That the random number did not occur at all.
Also include:
Use a sentinel driven outer While Loop to repeat the task
Ask the User if they wish to generate a new set of random numbers
Clear the previous list of numbers from the output screen before displaying the new set.
NOTE : Other than the prompt to repeat the task, there is no input from the User in this program.
NOTE : This program will have functions:
The function that fills the array with random numbers.
The function that generates one random number at a time reuse the one from Lab
The function that prints out an array of integers reuse the one from Lab
NOTE :
You must use the code within the previous lecture for generating a random number. Failure to do so will result in a zero with no opportunity to resubmit.
You must use the code within the lecture when filling or printing the arrays. Failure to do so will result in a zero with no opportunity to resubmit.
DO NOT use the "return code, end, break, continue, or exit to force an exit from within your IFELSE structure or any LOOPING structure. You will receive a with no opportunity to resubmit if you do
Let the program progress to the end of the main function.
The end of the main function is the only place that the return should be placed.
A switch statement is the only place that the break command should be placed.
The end, continue, and exit are forbidden.
You must place the function prototypes before the main header. Failure to do so will receive a with no opportunity to resubmit.
You must place the functions after the ending curly bracket of main. Failure to do so will receive a with no opportunity to resubmit.
Do not use the std functions, the printf function, the scanf function, the cout functions, or the cin functions. Only use cout for output and cin for input. Failure to do so will result in a zero with no opportunity to resubmit.
Declare all variables within the data declaration section. points
Do not get input on the same line as a variable declaration. points
Do not place an equation for computation on the same line as declaring a variable. point
Do not place an equation for computation on the same line as an input statement. points
Do not place a function call on the same line as a variable declaration. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
