Current issue - cant identify the problem

I made a similar program, to make sure I got the idea down, but apparently I dont. Even though it asks to play again, It doesn’t give me the chance to receive answer deciding to go with the pre-defined boolean instead. In this case it asks the question, and immediately answers for me(either playing again or quitting)

#include
#include
using namespace std;

void GTurn();
int GuessGame();
void ThyName();
string Responder();
int GTurnN = 0;
bool AskToPlayAgain();
void TheGame();

int main()
{

	GTurn();
	ThyName();
bool bPlayAgain = false;
	do 
	{
	GTurn();

	TheGame();
	bPlayAgain = AskToPlayAgain();
} 
while (bPlayAgain);            //While true is forever


return 0;

}

void GTurn()
{
GTurnN++;
cout << endl << "The current turn is: " << GTurnN << endl;
return;
}

int GuessGame()
{
cout << “Can you guess the current turn?” << endl;
int Guess = 0;
cin >> Guess;
return Guess;
}

void ThyName()
{
string Resp = “”;
string Nameth = “”;
cout << "greetings Human ,what iseth thy Name? - " << endl;
Nameth = Responder(); //putting the return Response string into Nameth
cout << "Oh, okay, well then hello " << Nameth << endl;
return;
}

string Responder()
{
string Resp = “”;
getline(cin, Resp);
cout << endl;
return Resp;
}

bool AskToPlayAgain()
{
cout << "Do you want to play again (y/n)? ";
string Response = “”;
system(“pause”);
getline(cin, Response);

cout << endl;
return (Response[0] == 'y') || (Response[0] == 'Y'); // 0 first char, = Y / y

}

void TheGame()
{

for (int count = 1; count <= 5; count++)
{

	int Guess = 0;
Guess = GuessGame(); // sets guess to 0, begins the guessgame to retrieve the guess
cout << "You guessed " << Guess << endl;
if (Guess > GTurnN)
{
	cout << "You guessed higer then the current turn." << endl;
}
else if (Guess == GTurnN)
{
	cout << "You guessed the turn! (Shame if you cheated :P)" << endl;
	break;
}
else
{
	cout << "You guessed a lower number." << endl;
}
}
return;

}

Privacy & Terms