izack1981
Legendary Member

- Messages
- 10,374
Paid Membership
- Joined
- Feb 15, 2007
- Messages
- 10,374
- Reaction score
- 61
- Points
- 120
Salam..
Sapa reti C++ buat prog macam nie?
Sapa reti C++ buat prog macam nie?
The program first asks the number of points the user wants to start with, as shown below:
How many points would you like? 2000
It then prints the guess menu and allows up to five guesses, as shown next:
Guesses Choices
O Odd
E Even
L Low
M Med
H High
F Left
C Center
R Right
N Number
How many guesses would you like? 5
Guess 1 :
Enter your choice: L
Points at risk? 20
Guess 2 :
Enter your choice: H
Points at risk? 15
Guess 3 :
Enter your choice: N
Enter your number: 18
Points at risk? 20
Guess 4 :
Enter your choice: O
Points at risk? 120
Guess 5 :
Enter your choice: L
Points at risk? 10
After all guesses have been made, the program generates the random number and displays the following message:
My number is: 31
The program then prints the situation of the player:
Previous Points: 2000
Guess
Type
Number
Amount
Win or Lose
1
L
20
-20
2
H
15
+30
3
N
18
20
-20
4
O
120
+120
5
L
10
+20
You won 140 points in this turn.
Your new balance is: 2140 points.
Do you want to play again (Y or NO)? Y