I am trying implement some graphics, but I am having trouble calling the function int rollDice() shown on the very bottom and am not sure how to solve this? any ideas... I am getting an error error C3861: 'rollDice': identifier not found.
int rollDice();
void CMFCApplication11Dlg::OnBnClickedButton1()
{
enum Status { CONTINUE, WON, LOST };
int myPoint;
Status gameStatus;
srand( (unsigned)time( NULL ) );
int sumOfDice = rollDice();
switch ( sumOfDice )
{
case 7:
case 11:
gameStatus = WON;
break;
case 2:
case 3:
case 12:
gameStatus = LOST;
break;
default:
gameStatus = CONTINUE;
myPoint = sumOfDice;
break;
}
while ( gameStatus == CONTINUE )
{
rollCounter++;
sumOfDice = rollDice();
if ( sumOfDice == myPoint )
gameStatus = WON;
else
if ( sumOfDice == 7 )
gameStatus = LOST;
}
if ( gameStatus == WON )
{
}
else
{
}
}
int rollDice()
{
int die1 = 1 + rand() % 6;
int die2 = 1 + rand() % 6;
int sum = die1 + die2;
return sum;
}
updated