Question: Use C++ (5 points) Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate
Use C++
(5 points) 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 to 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 are within 1 of each other. For example, the following shows the lottery array and the user array with sample numbers stored in each There are three digits within tl of each other (elements 0, 2 and 4). lottery array: 3 4 91 3 user array: 4 29 7 3 The program should display the random numbers stored in the lottery array and the number of digits within 1 of each other. If all of the digits are within 1 of each other, display a message proclaiming the user as a big prize winner
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
