Question
C++ In MegaMillions, players may pick six numbers from two separate pools of numbers five different numbers from 1 to 70 (white ball) and one
C++
In MegaMillions, players may pick six numbers from two separate pools of numbers five different numbers from 1 to 70 (white ball) and one number from 1 to 25 (mega ball). In PowerBall, players pick five different numbers from 1 to 69 (white ball) and one number from 1 to 26 (power ball). In each MegaMillions or PowerBall drawing, five random and non-repetitive numbers will be drawn from white balls, and one random number from the mega/power balls. You win the jackpot by matching all six winning numbers in a drawing.
1. Display your standard output information using a function named ShowProgramHeader()
2. Ask the user to select which lottery to play: MegaMillions or PowerBall
3. Get input from user in an array: five numbers for white ball and one additional number for mega or power ball
4. Write functions to:
a. Generate an array and initialize it with numbers 1 to 70 (MegaMillions) or 1 to 69 (PowerBall),
b. Shuffle the elements in the array and take the first five elements (so you get five random and non-repetitive numbers). To shuffle the elements, just swap each element with a random element in the array.
c. Get a random number from 1 to 25 (mega ball) or 1 to 26 (power ball), and
d. On screen, show output from steps b. and c. as the result of a drawing, and compare with the user input in step 3 to show whether the user wins the jackpot.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started