0

Hello! I'm new here and I'm trying to make a craps game as a project. When i get to a certain function where the player rolls and makes a point, then has to match that roll, I keep getting stuck in a loop. I'll paste the function that this takes place in. Any and all help would be greatly appreciated!

void TallyRoll (int roll)
{		
	int point,
		nextpoint = 0,
			

	if ((roll == 7) || (roll == 11))
	{
		cout << "wins!";
	}
	else if ((roll == 2) || (roll == 3) || (roll == 12))
	{
		cout << "loses!";
	}
	else
	{
		point = roll;
		
		cout << "The point is " << point << endl;
		
		
				
		do
		{
			nextpoint = DrawNum (MAX) + DrawNum (MAX);
			
			cout << "Rolled " << nextpoint << endl;
			cout << "Re-roll until matches " << point << endl;

		} while ((point != nextpoint) || (7 != nextpoint));		
	}
}
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by SndSystm
0

its probabably that while statement. when point == nextpost, when does nexpoint == 7? Lets say nextpoint == 2. The loop will become infinite because 7 != nextpoint is always true.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.