In C programming language. Objectives: • Use of functions and passing by value and reference. • Use of selection constructs. • Use of repetition constructs (loops). • The use of the random number generator and seeding. • Display formatted output using input/outputstatements. • Use format control strings to format text output. Description: For this project you are tasked with building a user application that will select sets of random numbers. Your application must use functions and pass values and pointers. Your program will pick sets of 6 random numbers with values of 1 to 53. The user should be able to choose how many sets to produce. The challenge will be to ensure that no number in a set of 6 numbers is a repeat. The number can be in another set just not a duplicate in the same set of 6. Your program should prompt the user and ask them how many number sets they wish to have generated. The program should not exit unless the user enters a value indicating they wish to quit.  Minimum Requirements: *input 0 to exist the application nistead of q or Q as shown in picture. Your program must make use of the following. 1. Your source code must compile for me.  2. Your program must use a user defined function to prompt the user for input and return it to the calling function. This function will determine the number of groups of 6 random numbers to generate. The function should also allow the user the opportunity to enter in a value to quit. You may use a character or a special number value to determine the user has selected to quit and your program would indicate this to the calling function (probably main). Your function will not exit the program but return a value to the calling function indicating the user wants to quit. Your main function should print out that your user has chosen to quit and then terminate. Your program should not terminate unless the user requests to quit. 3. Your program must use a user defined function to generate a random number set and return the values to the caller. Use pointers to values in the calling function to return multiple values. This function should take as arguments a value for the range and the offset and the pointers to the 6 integers in the calling function. This makes the function reusable for other random number needs. The function should return the random integers to the calling function. 4. The range and offset to be used in your program must use a defined constant (not a memory constant) and the defined constant must be all caps. The range should be inclusive values 1 thru53. 5. Your program should print the selected values to the screen in a meaningful format. For example: “Set #1 of six numbers is: XX XX XX XX XX XX” a newline and then “The second 6 numbers are: XX XX XX XX XX XX”. The output should use a minimum width of 2 for each number and there should be a space or comma between each number in the output.  6. Your program should make use of a loop to produce the sets of numbers requested by the user calling the user defined functions. The program should repeat unless the user enters in the option to quit. 7. If there is a repeated value in a set of 6 numbers.  8. Your program should contain a program description as a block comment at the top of your code as shown in the module 2 example. Your functions should also have function descriptions as shown in the same example.  9. Your user defined functions must use a function prototype in the global declarations area and have the function definitions under the main function with comments in your “other functions as needed” area of your source code.  10. Your variable names and function names must follow the naming conventions.     •Functions: Start with capitals and use either camel case or an underscore between the parts of a descriptive name for the function.   • Variables: start with lower case and use camel case or an underscore to separate the descriptive name pieces of the variable. • All Constants should be all uppercase.  11. Your program must be neat and your code should be tabbed in from the left margin. All nested blocks of code should be tabbed as well.  12. All functions should have a return statement even if they don’t return a value to the caller.  13. The seed function srand() should only be called once in main.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

In C programming language.

Objectives:
• Use of functions and passing by value and reference.
• Use of selection constructs.
• Use of repetition constructs (loops).
• The use of the random number generator and seeding.
• Display formatted output using input/outputstatements.
• Use format control strings to format text output.


Description:


For this project you are tasked with building a user application that will select sets of random numbers. Your application must use functions and pass values and pointers. Your program will pick sets of 6 random numbers with values of 1 to 53. The user should be able to choose how many sets to produce. The challenge will be to ensure that no number in a set of 6 numbers is a repeat. The number can be in another set just not a duplicate in the same set of 6. Your program should prompt the user and ask them how many number sets they wish to have generated. The program should not exit unless the user enters a value indicating they wish to quit. 


Minimum Requirements:

*input 0 to exist the application nistead of q or Q as shown in picture.


Your program must make use of the following.
1. Your source code must compile for me. 


2. Your program must use a user defined function to prompt the user for input and
return it to the calling function. This function will determine the number of groups
of 6 random numbers to generate. The function should also allow the user the
opportunity to enter in a value to quit. You may use a character or a special number
value to determine the user has selected to quit and your program would indicate
this to the calling function (probably main). Your function will not exit the program
but return a value to the calling function indicating the user wants to quit. Your
main function should print out that your user has chosen to quit and then terminate. Your program should not terminate unless the user requests to quit.


3. Your program must use a user defined function to generate a random number set
and return the values to the caller. Use pointers to values in the calling function to
return multiple values. This function should take as arguments a value for the range
and the offset and the pointers to the 6 integers in the calling function. This makes
the function reusable for other random number needs. The function should return
the random integers to the calling function.


4. The range and offset to be used in your program must use a defined constant (not a
memory constant) and the defined constant must be all caps. The range should be
inclusive values 1 thru53.

5. Your program should print the selected values to the screen in a meaningful format.
For example: “Set #1 of six numbers is: XX XX XX XX XX XX” a newline and then “The
second 6 numbers are: XX XX XX XX XX XX”. The output should use a minimum width
of 2 for each number and there should be a space or comma between each number
in the output. 


6. Your program should make use of a loop to produce the sets of numbers requested
by the user calling the user defined functions. The program should repeat unless the
user enters in the option to quit.


7. If there is a repeated value in a set of 6 numbers. 


8. Your program should contain a program description as a block comment at the top of
your code as shown in the module 2 example. Your functions should also have
function descriptions as shown in the same example. 


9. Your user defined functions must use a function prototype in the global declarations
area and have the function definitions under the main function with comments in
your “other functions as needed” area of your source code. 


10. Your variable names and function names must follow the naming conventions.     •Functions: Start with capitals and use either camel case or an underscore between the parts of a descriptive name for the function. 
 • Variables: start with lower case and use camel case or an underscore to separate the descriptive name pieces of the variable.

• All Constants should be all uppercase. 


11. Your program must be neat and your code should be tabbed in from the left margin.
All nested blocks of code should be tabbed as well. 


12. All functions should have a return statement even if they don’t return a value to the
caller. 


13. The seed function srand() should only be called once in main. 

****
* Enter in the number of randomly generated sets of numbers you want or
enter in a 'q' or 'Q' to quit.
* Your Input: 9
1 of six numbers is:
2 of six numbers is:
3 of six numbers is: 6
4 of six numbers is:
Set #
22 43 15 40 34
Set #
45
53 23
13 31 37
Set #
9 40
36 21 35
Şet #
37
51
27
14
33
20
5 of six numbers is:
6 of six numbers is:
7 of six numbers is:
8 of six numbers is:
* Set # 9 of six numbers is:
Set #
26 36
1
22 40
Set #
43
34
52
47
26
51
Set #
48
38
10
21
47
Set #
13
39
29
33
20
9
35
18
2
14
16 27
***:
* Enter in the number of randomly generated sets of numbers you want or
* enter in a 'q' or 'Q' to quit.
*本**
* *
* Your Input: 9
You have chosen to exit the application.
Transcribed Image Text:**** * Enter in the number of randomly generated sets of numbers you want or enter in a 'q' or 'Q' to quit. * Your Input: 9 1 of six numbers is: 2 of six numbers is: 3 of six numbers is: 6 4 of six numbers is: Set # 22 43 15 40 34 Set # 45 53 23 13 31 37 Set # 9 40 36 21 35 Şet # 37 51 27 14 33 20 5 of six numbers is: 6 of six numbers is: 7 of six numbers is: 8 of six numbers is: * Set # 9 of six numbers is: Set # 26 36 1 22 40 Set # 43 34 52 47 26 51 Set # 48 38 10 21 47 Set # 13 39 29 33 20 9 35 18 2 14 16 27 ***: * Enter in the number of randomly generated sets of numbers you want or * enter in a 'q' or 'Q' to quit. *本** * * * Your Input: 9 You have chosen to exit the application.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning