Question: Design a C++ program that simulates a lottery. The user can choose between lottery and LOTO. The program should have an array of five integers

Design a C++ program that simulates a lottery. The user can choose between lottery and LOTO. The program should have an array of five integers in the lottery version, and six digits in the LOTO version. The program should generate a random number in the range of 0 through 9 for each element in the array (lottery) and in the range of 1 to 46 for LOTO version. The programs should generate a file with the winner number, type of lottery, # of matching digits (LOTO) and the prize.

LOTO version: 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 of $1,000,000. If there are five matching digits, the prize should be $500,000 and if there are four matching digits, the prize should be $250,000 and if there are three matching digits, you have a free new ticket.

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!