Question: C++ Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number

C++

C++ Write a program that simulates a lottery. The program should have

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 the corresponding elements in the two arrays and keep a count of the digits that match. For example, the following shows the lottery array and the user array with sample numbers stored in each. There are two matching digits (elements 2 and 4). Lottery array: 74913 User array: 42973 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. The program should define the following functions: - A function generates random numbers and stores them in the lottery array. - A function gets the user's lottery picks. - A function finds the number of the user's values that match the lottery numbers. The number of matches is returned. - A Function displays the values in the lottery array and the user array

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 Databases Questions!