Question: Lottery Application Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random
Lottery Application
Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number in the range of through for each element in the array. The user should enter five digits, which should be stored in an integer array named user. The program is to compare that match. For examd. ing elements in the two arrays and keep a count of the digits the sample numbers stom, the following shows the lottery array and the user array with sampers stored in each. There are two matching digits elements and
Programming Challenges
Lottery array:
table
User array:
table
The program should display the random numbers stored in the lottery array and the number of matching digits. If all of the digits match, display a message proclaiming the user as a grand prize winner.
Complete the programming assignment on page # Lottery Application.
However, you will need to implement the following:
user numbers not for the lottery numbers
a function that gets the users numbers such as void userNumbersint array
a function that randomly generates the lottery numbers such as voind generateWinningNumbersint array
a function bool validPickint numbers!, int numto check this should return false if the number is already in the array otherwise it should assign the number into the array and return true
a function that determines how many numbers match such as int matchconst int player const int lotto note: numbers do not need to be in the same index possition to be a match. A nested loop might be helpful
Don't forget to use function prototypes and no global variables. Global constants however are fine to use.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
