Question
PROGRAM NEEDS TO BE WRITTEN IN C++ Jumping in the Mega Millions fever, your lab is to write a program that simulates the Mega Millions
PROGRAM NEEDS TO BE WRITTEN IN C++
Jumping in the Mega Millions fever, your lab is to write a program that simulates the Mega Millions lottery draw. Your program must have an array of five integers named winningNumbers, with a randomly generated number in the range of 0 through 9 for each element in the array. Your program should ask the user to enter five numbers and should store them in a second integer array named player. The program must compare the corresponding elements in the two arrays and count how many numbers match. For example, the following shows the winningNumbers array and the Player array with sample numbers stored in each. There are two matching elements, elements 2 and 4.
winningNumbers | 7 | 4 | 9 | 1 | 3 |
Player | 4 | 2 | 9 | 7 | 3 |
Once the user has entered a set of numbers, the program should display the winning numbers and the players numbers and tell how many numbers matched.
Here is an example of the possible output from your code:
/* SAMPLE RESULTS RUN 1
Submit the five numbers of your lottery number, separated by blanks: 9 3 4 4 1
Winning number: 30766 Your number : 93441
You have 0 matching digit(s).
SAMPLE RESULTS RUN 2
Enter the five numbers of your lottery number, separated by blanks: 5 5 4 1 7
Winning number: 46419 Your number : 55417
You have 2 matching numbers. */
Please use basic coding solution only
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