C++ Write a program to simulate a lottery drawing that uses balls numbered from
ID: 3759909 • Letter: C
Question
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. SAMPLE OUTPUT: Enter number of lottery drawings =>-4 Number of lottery drawings must be greater than 0! Please re-enter number of lottery drawings =>5 Roll #1 5 9 6 4 10 Roll #2 10 9 7 3 2 Roll #3 6 5 3 1 4 Roll #4 5 6 2 4 3 Roll #5 10 1 9 8 4 Percentages of all even = 0% Percentages of sevens = 20% Percentages of all 1-2-3-4-5 order = 0% Another round for the lottery? Type 1 for yes, any other number for no: 1 Enter number of lottery drawings =>3 Roll #1 4 10 6 9 7 Roll #2 1 5 8 9 3 Roll #3 2 10 7 6 3 Percentages of all even = 0% Percentages of sevens = 66.6667% Percentages of all 1-2-3-4-5 order = 0% Another round for the lottery? Type 1 for yes, any other number for no: 2
Explanation / Answer
void Lottery(int x) { int random_integer, user_input, lowest=1, highest=10, range=(highest-lowest)+1; cout > user_input; for (int index = 0; indexRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.