//************************************************************************************
//function playagain();
//parameters char cAns
//resets game variables and board or exits game
//************************************************************************************
void playagain(char cAns)
{
cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player
cin>>cAns;//sts value to variable
do
{
iTotalMoves=0;//resets # of moves
ResetBoard();//resets game array
cPlayerSymbol='a';//resets game char (so that function will ask the player X or O again)
symbol(); // ask the player's symbol then calls the game function
}
while(cAns=='y' || 'Y');//but no matter what I type (as long as it's not y or Y, it loops into the game again
return(0);
}
it's not exiting, and I know I coded this this way before.
or should I do it this way
//************************************************************************************
//function playagain();
//parameters char cAns
//resets game variables and board or exits game
//************************************************************************************
void playagain(char cAns)
{
cout<<"would you like to play again?(y/n)"<<endl;//function call depending of the choice of the player
cin>>cAns;//sts value to variable
if(cAns=='y' || 'Y')
{
iTotalMoves=0;//resets # of moves
ResetBoard();//resets game array
cPlayerSymbol='a';//resets game char (so that function will ask the player X or O again)
symbol(); // ask the player's symbol then calls the game function
}
else
{
return(0);
}
}