Question

In C... Write a program to simulate a pick-5 lottery game. Your program must generate and...

In C...

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
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
In C... Write a program to simulate a pick-5 lottery game. Your program must generate and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Write a C++ program that simulates a lottery game. Your program should use functions and arrays....

    Write a C++ program that simulates a lottery game. Your program should use functions and arrays. Define two global constants: - ARRAY_SIZE that stores the number of drawn numbers (for example 5) -MAX_RANGE that stores the highest value of the numbers ( for example 9 ) The program will use an array of five integers named lottery, and should generate a random number in the range of 0 through 9 for each element of the array. The user should enter...

  • Write a C++ program that simulates playing the Powerball game. The program will generate random numbers...

    Write a C++ program that simulates playing the Powerball game. The program will generate random numbers to simulate the lottery terminal generated numbers for white balls and red Powerball. The user will have the option to self-pick the numbers for the balls or let the computer randomly generate them. Set the Grand Prize to $1,000,000,000.00 in the program. Project Specifications Input for this project: Game mode choice – self pick or auto pick Five numbers between 1 and 69 for...

  • Using C++ create a lotto program Lottery Design a program that simulates a lottery. Requirements:  The program...

    Using C++ create a lotto program Lottery Design a program that simulates a lottery. Requirements:  The program should have an array of 5 integers named lottery and should generate a random number in the range of 1 through 99 for each element of 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...

  • Hello, I am working on a C++ pick 5 lottery game that gives you the option...

    Hello, I am working on a C++ pick 5 lottery game that gives you the option to play over and over. I have everything working right except that every time the game runs it generates the same winning numbers. I know this is an srand or rand problem, (at least I think it is), but I can't figure out what my mistake is. I've tried moving srand out of the loop, but I'm still getting the same random numbers every...

  • Need help with assignment This assignment involves simulating a lottery drawing. In this type of lottery...

    Need help with assignment This assignment involves simulating a lottery drawing. In this type of lottery game, the player picks a set of numbers. A random drawing of numbers is then made, and the player wins if his/her chosen numbers match the drawn numbers (disregarding the order of the numbers). More specifically, a player picks k distinct numbers between 1 and n (inclusive), as well as one bonus number between 1 and m (inclusive). "Distinct" means that none of the...

  • PYTHON Write a program for playing a game with the computer. First, generate a random integer...

    PYTHON Write a program for playing a game with the computer. First, generate a random integer in the range of 6 through 9. This will be the computer’s pick. Then generate three random integers for the human player. These random integers are in the range of 1 through 10. If any of these three random integers is greater than the computer’s pick, the human player wins the game. Otherwise, the human player loses. You must use a for loop to...

  • Write a C program to simulate an online lottery game. Assume that the winning numbers are...

    Write a C program to simulate an online lottery game. Assume that the winning numbers are 10 and their values are within [0, 100]. Write a C program in a way to control the winning numbers. In particular, the "cheat" is that 3 of the winning numbers in each lottery should have also been drawn in the previous one. The C program asks the user to play, and if the answer is no, the program terminates.

  • Write a c progam to simulate an online lottery game. Assume that the winning numbers are...

    Write a c progam to simulate an online lottery game. Assume that the winning numbers are 10 and their values are within [0,100]. Write a C program in a way to control the winning numbers. In particular, the "cheat" is that 3 of the winning numbers in each lottery should have also been drawn in the previous one. The C program asks the user to play, and if the answer is no, the program terminates.

  • Using the Random, write a simulation that will "play" the California Super LOTTO. Your program logic will allow the player to: 1) Pick any 6 integer numbers from 1 - 70. Your logic should prev...

    Using the Random, write a simulation that will "play" the California Super LOTTO. Your program logic will allow the player to: 1) Pick any 6 integer numbers from 1 - 70. Your logic should prevent the player from selecting a value LESS than 1 or greater than 70. The logic should prevent the player from selecting the SAME number (i.e. they cannot have two or more of their selections be the SAME number). 2) Display the players' 6 number selections...

  • Sudoku Game Real Please write a Java program to play a Sudoku game and show its...

    Sudoku Game Real Please write a Java program to play a Sudoku game and show its winning result. This is an application program of using 2-dimensional arrays.   Each array is for a game board of 9 x 9. Your program must know how to play Sudoku game and complete the game with a winning result. The following is a sample test, which must be all your test cases. As you can see, you must pre-load the following 4 games into...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT