. 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
icon
Related questions
Question

C PROGRAMMING ONLY PLEASE! NO IOSTREAM.H OR CACIO.H HEADER FILES PLEASE! THANK YOU!

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.
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Bare Bones Programming Language
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr