. Create a simple slot machine that will meet these following requirements. 1. The machine should ask the user how much money he/she is willing to Deposit. 2. The machine should ask the user how much money he/she is willing to Bet per each round. 3. The slot machine will display 3 numbers 0, 1, and 2. 4. The choice of these numbers should be decided by srand() and rand() functions in c. [How to use rand() function in c a. Num=rand() %3; //This line will generate a number between 0, 1, and 2 and assign the number to Num variable b. rand() requires #include 5. The choice of these 3 numbers should be computed outside of main() function - in other words, use the USER defined function. 6. Each round, the Deposit will be deducted by the amount of the Bet 7. When first two numbers match, the user will receive x1 of the Bet 8. When all three numbers match, the user will receive x2 of the Bet. *So, conditions 6, 7, and 8 express the rule of gambling. No matches, you will lose the Bet money (Deposit - Bet) First two numbers match, you will break even (Deposit - Bet + Bet) When 3 numbers match you make some (Deposit - Bet + 2 x Bet) 9. After each round, the user should be prompted whether he/she would like to play more. 10. If the Deposit money runs out, the game should end automatically.
. Create a simple slot machine that will meet these following requirements. 1. The machine should ask the user how much money he/she is willing to Deposit. 2. The machine should ask the user how much money he/she is willing to Bet per each round. 3. The slot machine will display 3 numbers 0, 1, and 2. 4. The choice of these numbers should be decided by srand() and rand() functions in c. [How to use rand() function in c a. Num=rand() %3; //This line will generate a number between 0, 1, and 2 and assign the number to Num variable b. rand() requires #include 5. The choice of these 3 numbers should be computed outside of main() function - in other words, use the USER defined function. 6. Each round, the Deposit will be deducted by the amount of the Bet 7. When first two numbers match, the user will receive x1 of the Bet 8. When all three numbers match, the user will receive x2 of the Bet. *So, conditions 6, 7, and 8 express the rule of gambling. No matches, you will lose the Bet money (Deposit - Bet) First two numbers match, you will break even (Deposit - Bet + Bet) When 3 numbers match you make some (Deposit - Bet + 2 x Bet) 9. After each round, the user should be prompted whether he/she would like to play more. 10. If the Deposit money runs out, the game should end automatically.
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 3E
Related questions
Question
C
![4.. Create a simple slot machine that will meet these following requirements.
1. The machine should ask the user how much money he/she is willing to Deposit.
2. The machine should ask the user how much money he/she is willing to Bet per each round.
3. The slot machine will display 3 numbers 0, 1, and 2.
4. The choice of these numbers should be decided by srand() and rand() functions in c.
[How to use rand() function in c
a. Num=rand ( ) %3; //This line will generate a number between 0, 1, and 2 and assign the
number to Num variable
b. rand() requires #include <stdlib.h>
5. The choice of these 3 numbers should be computed outside of main() function - in other words,
use the USER defined function.
6. Each round, the Deposit will be deducted by the amount of the Bet
7. When first two numbers match, the user will receive x1 of the Bet
8. When all three numbers match, the user will receive x2 of the Bet.
*So, conditions 6, 7, and 8 express the rule of gambling.
No matches, you will lose the Bet money (Deposit - Bet)
First two numbers match, you will break even (Deposit - Bet + Bet)
When 3 numbers match you make some (Deposit - Bet + 2 x Bet)
9. After each round, the user should be prompted whether he/she would like to play more.
10. If the Deposit money runs out, the game should end automatically.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fecd9d238-92a1-4a47-af9e-c758e887edd1%2F6def278c-fad5-4384-a660-4b1a1ac7f76b%2Faeda38o_processed.png&w=3840&q=75)
Transcribed Image Text:4.. Create a simple slot machine that will meet these following requirements.
1. The machine should ask the user how much money he/she is willing to Deposit.
2. The machine should ask the user how much money he/she is willing to Bet per each round.
3. The slot machine will display 3 numbers 0, 1, and 2.
4. The choice of these numbers should be decided by srand() and rand() functions in c.
[How to use rand() function in c
a. Num=rand ( ) %3; //This line will generate a number between 0, 1, and 2 and assign the
number to Num variable
b. rand() requires #include <stdlib.h>
5. The choice of these 3 numbers should be computed outside of main() function - in other words,
use the USER defined function.
6. Each round, the Deposit will be deducted by the amount of the Bet
7. When first two numbers match, the user will receive x1 of the Bet
8. When all three numbers match, the user will receive x2 of the Bet.
*So, conditions 6, 7, and 8 express the rule of gambling.
No matches, you will lose the Bet money (Deposit - Bet)
First two numbers match, you will break even (Deposit - Bet + Bet)
When 3 numbers match you make some (Deposit - Bet + 2 x Bet)
9. After each round, the user should be prompted whether he/she would like to play more.
10. If the Deposit money runs out, the game should end automatically.
![Please use the following output shots as an example
a) When first two numbers match and when nothing matches
Let's play Slot Machine - Viva Las Vegas!
How much deposit will you make?
100
How much bet will you make this time?
20
I 2 | 1
Congratulations! You have the FIRST 2 numbers matching!
You earned 20 in this Round!
Your current balance is 100!
Do you wish to continue?
Type N if you wish to stop
||
Y
|
2
1|2|1
Sorry you didn't earn anything
Your current balance is 80!
Do you wish to continue?
Type N if you wish to stop
b) When three numbers match
2 1 2 12 I
Congratulations! You have ALL 3 numbers matching!
You earned 40 in this Round!
Your current balance is 100!
Do you wish to continue?
Type N if you wish to stop](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fecd9d238-92a1-4a47-af9e-c758e887edd1%2F6def278c-fad5-4384-a660-4b1a1ac7f76b%2Fcd3p1if_processed.png&w=3840&q=75)
Transcribed Image Text:Please use the following output shots as an example
a) When first two numbers match and when nothing matches
Let's play Slot Machine - Viva Las Vegas!
How much deposit will you make?
100
How much bet will you make this time?
20
I 2 | 1
Congratulations! You have the FIRST 2 numbers matching!
You earned 20 in this Round!
Your current balance is 100!
Do you wish to continue?
Type N if you wish to stop
||
Y
|
2
1|2|1
Sorry you didn't earn anything
Your current balance is 80!
Do you wish to continue?
Type N if you wish to stop
b) When three numbers match
2 1 2 12 I
Congratulations! You have ALL 3 numbers matching!
You earned 40 in this Round!
Your current balance is 100!
Do you wish to continue?
Type N if you wish to stop
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr