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 0 through 9 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 2 and 4).
Programming Challenges
459
Lottery array:
\table[[7,4,9,1,3]]
User array:
\table[[4,2,9,7,3]]
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 458 #14 Lottery Application.
However, you will need to implement the following:
user numbers 1-10 not 0-9 for the lottery numbers
a function that gets the users numbers such as void userNumbers(int array[])
a function that randomly generates the lottery numbers such as voind generateWinningNumbers(int array[])
a function bool validPick(int numbers!, int num_to 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 match(const 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.
Lottery Application Write a program that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!