(note: in C++) Write a program to simulate a lottery drawing that uses balls num
ID: 3760404 • Letter: #
Question
(note: in C++)
Write a program to simulate a lottery drawing that uses balls numbered from 1 to 10.
Assume that five balls are drawn at random. All five balls for each drawing are unique. Allow the user to enter the number of lottery drawings to simulate. Validate the input of lottery drawings.
What percentage of the time does the result contain five even numbers in the simulation?
What percentage of the time does the number 7 occur in the five numbers in the simulation?
What percentage of the time do the numbers 1, 2, 3, 4 and 5 occur in simulation (in any order)?
Use at least three functions:
Function to get number of lottery drawings and validate
Function to generate unique random numbers (no duplicate numbers in a roll)
Function to calculate percentages
Your program should run as long as user would like.
Explanation / Answer
int balldrawings(int&) { int draw; double even(0), seven(0), one_two_three(0); // Declare Variables double percent_even = 0.0, percent_seven = 0.0, percent_123 = 0.0; int maxpos= 1; int ct= 1; // Input From User cout > draw; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.