Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C PROGRAMMING Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9

C PROGRAMMING

Write a program to simulate a pick-5 lottery game.

Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array.

The program prompts the user for:

an integer random seed

five distinct integers between 1 and 9 (which are stored in another array)

The program then compares the two arrays to determine if they are identical.

If the two arrays are identical, then the user wins the game.

otherwise, the program outputs the number of matching digits and their position in the array.

For Example:

Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 1 2 3 4 5 You didn't match any numbers! The winning numbers are: 6, 3, 5, 1, 4 Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 6 3 1 2 3 You only matched 2 numbers. Your numbers matched the Pick-5 numbers at position(s): 0, 1 The winning numbers are: 6, 3, 5, 1, 4 Enter an integer random seed: 45 To play the Pick-5 game, enter five integers bewteen 1 and 9 (inclusive): 6 3 5 1 4 Congratulations!!! You WIN!!! The winning numbers are: 6, 3, 5, 1, 4

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 Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

Why wont getting mad work in Mexico or Japan?

Answered: 1 week ago