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));		
	}
}

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.

You were absolutely right. Fixed now, thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.