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 20 and name it "randomArray." Use the function in step 2 to fill the array. Use the function in step 3 to print the array.
Create a function that generates 20 random integers with a range of 1 to 10 and places them into an array. Re-use the functions from Lab 10 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. Re-cycle the function that prints out the contents of an integer array from Lab 10.
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 1 to 10) 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 1: Other than the prompt to repeat the task, there is no input from the User in this program.
NOTE 2: This program will have 3 functions:
The function that fills the array with random numbers.
The function that generates one random number at a time (re-use the one from Lab 10).
The function that prints out an array of integers (re-use the one from Lab 10).
NOTE 3:
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 0" code, end, break, continue, or exit to force an exit from within your IF/ELSE structure or any LOOPING structure. You will receive a 0 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 0 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 0 with no opportunity to resubmit.
You must place the functions after the ending curly bracket of main. Failure to do so will receive a 0 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. (-.2) points
Do not get input on the same line as a variable declaration. (-.2) points
Do not place an equation for computation on the same line as declaring a variable. (-.2) point
Do not place an equation for computation on the same line as an input statement. (-.2) points
Do not place a function call on the same line as a variable declaration. (-.2) points

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!