Sorry you were correct the error I get was an initializing error and not a declaration error.
I set it now to:
int POINT = 0;
And I had the other 2 reversed like you said. Now POINT = myRoll
I no longer get the error but I've run into trouble with the nested If statement within the while statement. Here are the changes I made (I only made changes to the playLineFunction)
- void playLineFunction(int myRoll)
-
{
-
int POINT = 0;
-
-
if (myRoll == 7 || myRoll == 11)
-
{
-
cout << "You win!" << endl;
-
}
-
if (myRoll == 2 || myRoll == 3 || myRoll == 12)
-
{
-
cout << "You lose! Crapped out" << endl;
-
}
-
else
-
{
-
POINT = myRoll;
-
cout << "You've established a point of " << POINT << endl;
-
}
-
while (myRoll != 7)
-
{
-
myRoll = CrapsRoll();
-
if (myRoll = POINT)
-
{
-
cout << "You win!" << endl;
-
-
}
-
}
-
cout << "You Lose! Seven out" << endl;
-
}
-
Ideally when the program runs it sets POINT equal to myRoll. While myRoll does not equal to 7 (7 means you've lost after you've established a point) myRoll calls the CrapsRoll function and gets a new value. Then it goes to the nested if statement saying you win if myRoll is equal to POINT.
The problem is that the program is saying "You win!" even when myRoll doesn't equal POINT also, it does not exit the while loop when myRoll is 7. So as of now it's in an infinite loop. I think this has to do with line 20 where it calls the CrapsRoll function.
I know I've set POINT = myRoll which would cause an infinteloop of "You win!" but it should be getting a new value for myRoll from the CrapsRoll function which would cause it loop until it rolls a 7 or it rolls the value of POINT.
I think that explains my new problem. Thanks for the help before boxfish