Hey Can you help me solve this problem please Its C ooo TMob
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




