Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Write a C++ program that simulates a lottery. The program should have an array of five integers named "lottery numbers", 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 "your numbers". The program is to compare the elements in the two arrays and keep a count of the digits that match. The program should be able to count matches regardless of what order the numbers are in, and there are no duplicate numbers in the ticket or the drawing. For example, the following output picture shows the lottery array and the user array with sample numbers stored in each. There are three matching digits (elements 6, 1 and 2). 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.

image text in transcribedNOTE:

Add a powerball element to the lottery, the powerball can be values between 1 - 3, then report how many regular numbers matched along with whether the powerball matched.

Assign 'winnings' values where the more numbers that are matched, the higher the winnings (1 match = $5, 2 matches= $10, 3 matches = $20, 4 matches = $50 and all 5 matches = $100)

Out pob Aumber pic be LotemAumbesi 01032 Jour num bers yarn nate heel 3 num bers

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions