Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming Generating your own code Lottery Application (Required) Write a program that simulates a lottery. The program should have an array of five integers

C++ Programmingimage text in transcribed

Generating your own code Lottery Application (Required) 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: 7 4 9 1 3 user array. 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: 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 users values that match the lottery numbers. The number of matches is returned. Function displays the values in the lottery array and the user array. A A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions