Hi ,(adsbygoogle = window.adsbygoogle || []).push({});

I have a problem coding a part of a simulating game:

In the game of craps, a "Pass line" bet proceeds as follows. The first roll of the two, six-sided dice in a craps round is called the "come out roll". The bet immediately wins when the come out roll is 7 or 11, and loses when the come out is 2,3 or 12.

If 4,5,6,8,9 or 10 is rolled on the come out roll, that number becomes " the point". The player keeps rolling the dice until either 7 or the point is rolled. If the point is rolled first, then the player wins the bet. If the player rolls a 7 first, the the player loses.

you need to indicate the total number of wins and losses.

The part that bothers me is the underline part.

This is the code I've done for this underlined part:

Please can you help to organize my code ?Code (Text):

.

.

.

if(roll==4||roll==5||roll==6||roll==8||roll==9||roll==10)//point case

{

cout<<roll<<" points"<<endl;

do

{

roll=dice();//dice- function that simulates the 2 dice throwings

cout<<endl;

cout<<"roll "<<roll<<endl;

if(roll==7)

cout<<roll<<" the point got to 7. player loses"<<endl;

if(roll==4||roll==5||roll==6||roll==8||roll==9||roll==10)

cout<< roll<<" the roll got to 'point'. player wins"<<endl;

}

while(roll==7||roll==4||roll==5||roll==6||roll==8||roll==9||roll==10);

}// end if

.

.

.

Thank you

Bertrand

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Game problem

**Physics Forums | Science Articles, Homework Help, Discussion**