Hey Can you help me solve this problem please Its C ooo TMob

Hey! Can you help me solve this problem please!
It\'s C++
ooo T-Mobile LTE 6:10 PM Done Assignment6.docx Objectives: This assignment provides more practice on using functions to solve problems. Specific reference. Note that no array is needed in this assignment. You are encouraged to use array if you know how to use it. We expect the program to consist of several small functions. The functions should be called in the main function to simulate a game. objectives include: call-by-value, Description: Craps is a popular gambling game. The rules of the game are as follows: The player rolls 2 dice the first time (the \"come out roll\"). If the 2 dice sum to 7 or it is a \"natural\" and the player wins. If the sum of the 2 dice is 2, 3 or 12 then it is \"craps\" and the player loses. Any other sum on the first roll 4, 5, 6, 8, 9, or 10 becomes the player\'s \"point\". The player then continues to roll the dice until either the player rolls the point again or until 7 is rolled. If the player rolls the point again then the player wins. If the player rolls 7 before rolling the point again then the player loses. Here are some example outcomes of games. Game 1: 7 (win) Game 2: (win) Game 3: 2 (lose) Game 4: 3 (lose) Game 5: 12 (lose) Game 6: 8, 2, 6, 11, 8 (win) Game 7: 9, 12,6,7 (lose) The player starts off with an initial account of ($1000). The player can bet some amount of money (less than or equal to his current account) in a game. If the player wins he gets double the amount of what he bet. If he loses, the money he bet will be reduced from its current account. For example, the current account of a player is $500. He bets S100 on a game. If he wins, his account will be S 600 (500 +100). If he loses, his account will become S 400 (500-100). Your Program allows the user to play more than one games. It should give the player four options to choose: 1. Play another game 2. Print the summary of all the games played 3. Help 4. Quit. Here are some suggested functions. It is your job to define the input and output parameters. You are free to insert input parameters/arguments in the functions. You can also change the

Solution

#include<iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int sum, money = 1000, w = 0, l = 0;
static int g = 0;
//Help function
void help()
{
cout<<\"\ The Rule of the game: \ \";
cout<<\"\ The player rolls 2 dice first time: \";
cout<<\"\ If the 2 dice sum to 7 or 11 it is natural and the player wins \";
cout<<\"\ If the sum of 2 dice is 2, 3, or 12 then it is craps and the player loses \";
cout<<\"\ Any other sum on the first roll 4, 5, 6, 8, 9 or 10 becomes the player point \";
cout<<\"\ The player then continues to roll the dice until either the player rolls the point again or until 7 is rolled \";
cout<<\"\ If the player rolls the point again then the player wins. \ If the player rolls 7 before rolling the point again then the player loses \";
}
//Displays menu
void PrintMenu()
{
cout<<\"\ P - Play one game of Craps \";
cout<<\"\ R - Print a summary of all the game played \";
cout<<\"\ H - Help \";
cout<<\"\ Q - Quit \";
}
//Rolls dice generates random number between 1 to 6 including both
int RollOneDice()
{
srand(time(0));
return (rand() % 6 + 1);
}
//First roll
char FirstRoll()
{
int f, s, sum;
f = RollOneDice();
s = RollOneDice();
sum = f + s;
//Checks for win
if(sum == 7 || sum == 11)
return \'W\';
//Checks for loss
else if(sum == 2 || sum == 3 || sum == 12)
return \'L\';
else
return \'C\';
}
//Other roll
void OtherRolls()
{
int f, s;
sum = 0;
f = RollOneDice();
s = RollOneDice();
sum = f + s;
}
//Play game
void PlayOneGameOfCrap()
{
char c;
int b;
g++;
cout<<\"\ Current Account: \"<<money;
cout<<\"\ How Much you want to beat \";
cin>>b;
c = FirstRoll();
//For win
if(c == \'W\')
{
cout<<\"\ Game \"<<g<<\" : \"<<c<<\" <WIN>\";
cout<<\"\ Current Account: \"<<money+b;
w++;
}
//For loss
else if(c == \'L\')
{
cout<<\"\ Game \"<<g<<\" : \"<<c<<\" <LOSS>\";
cout<<\"\ Current Account: \"<<money-b;
l++;
}
//For point
else
{
for(int p = 0; p < 4; p++)
{
OtherRolls();
if(sum == 7)
break;
}
if(sum == 7)
{
cout<<\"\ Game \"<<g<<\" : \"<<c<<\" <LOSS>\";
cout<<\"\ Current Account: \"<<money-b;
l++;
}
else
{
cout<<\"\ Game \"<<g<<\" : \"<<\"<WIN>\";
cout<<\"\ Current Account: \"<<money+b;
w++;
}
}
}
//Print summery
void printSumm()
{
cout<<\"\ Total Number of Games \\t Wins \\t Loss \\t \"<<endl;
cout<<\"\\t\"<<g<<\"\\t\\t\\t\"<<w<<\"\\t\"<<l;
}
int main()
{
char cho;
do
{
PrintMenu();
//Accepts choice from the user
cout<<\"\ Enter your choice: \";
cin>>cho;
switch(cho)
{
case \'P\': case \'p\':
PlayOneGameOfCrap();
break;
case \'R\': case \'r\':
printSumm();
break;
case \'H\': case \'h\':
help();
break;
case \'Q\': case \'q\':
exit(0);
default:
cout<<\"\ ERROR: Wrong choice: \";
}
}while(1);
}

Output:

P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: h

The Rule of the game:

The player rolls 2 dice first time:
If the 2 dice sum to 7 or 11 it is natural and the player wins
If the sum of 2 dice is 2, 3, or 12 then it is craps and the player loses
Any other sum on the first roll 4, 5, 6, 8, 9 or 10 becomes the player point
The player then continues to roll the dice until either the player rolls the point again or until 7 is rolled
If the player rolls the point again then the player wins.
If the player rolls 7 before rolling the point again then the player loses
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: p

Current Account: 1000
How Much you want to beat 100

Game 1 : <WIN>
Current Account: 1100
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: p

Current Account: 1000
How Much you want to beat 50

Game 2 : <WIN>
Current Account: 1050
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: p

Current Account: 1000
How Much you want to beat 200

Game 3 : <WIN>
Current Account: 1200
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: p

Current Account: 1000
How Much you want to beat 400

Game 4 : <WIN>
Current Account: 1400
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: p

Current Account: 1000
How Much you want to beat 20

Game 5 : <LOSS>
Current Account: 980
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: r

Total Number of Games Wins Loss
5 4 1
P - Play one game of Craps
R - Print a summary of all the game played
H - Help
Q - Quit
Enter your choice: q

Hey! Can you help me solve this problem please! It\'s C++ ooo T-Mobile LTE 6:10 PM Done Assignment6.docx Objectives: This assignment provides more practice on u
Hey! Can you help me solve this problem please! It\'s C++ ooo T-Mobile LTE 6:10 PM Done Assignment6.docx Objectives: This assignment provides more practice on u
Hey! Can you help me solve this problem please! It\'s C++ ooo T-Mobile LTE 6:10 PM Done Assignment6.docx Objectives: This assignment provides more practice on u
Hey! Can you help me solve this problem please! It\'s C++ ooo T-Mobile LTE 6:10 PM Done Assignment6.docx Objectives: This assignment provides more practice on u

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site