void Intro_Game();
void Login_Entrace();
bool Ask_PlayAgain();
string User_Login(string);
constexpr int WORLD_LENGHT = 5;
int main()
{
bool PlayAgain_Count = false;
do
{
system("cls");
Intro_Game();
Login_Entrace();
PlayAgain_Count = Ask_PlayAgain();
} while (PlayAgain_Count);
return 0;
}
void Intro_Game()//Intro Game
{
cout << "Welcome to Bulls & Cow\n";
cout << "Can you guess the " << WORLD_LENGHT << " isogram I'm think of?\n\n";
}
//entrace of data process fase
void Login_Entrace()
{
string x[5];
int j = 1;
//begin fase
for (int i = 0; i < WORLD_LENGHT; i++)
{
cout << "Enter with Guess " << j << ": ";
x[i] = User_Login(x[i]);
system("cls");
j++;
}
j = 0;
for (int i = 0; i < WORLD_LENGHT; i++)
{
++j;
cout << "Guess " << j << " name is: " << x[i] << "\n\n";
}//end fase
}
bool Ask_PlayAgain()
{
string resp;
cout << "Do wanna play again?\n";
cin >> resp;
if (resp[0] == 'Y' || resp[0] == 'y')
return true;
if (resp[0] == 'N' || resp[0] == 'n')
{
system("cls");
cout << "You say no. =(\n";
return false;
}
if(resp[0] != 'N' || resp[0] != 'n' && resp[0] != 'Y' || resp[0] != 'y')
{
system("cls");
cout << "Wrong awnser please try again\n";
return Ask_PlayAgain();
}
}
//Read user login name
string User_Login(string Guess)
{
getline(cin, Guess);
return Guess;
}
Update
I'm going to post this photo, hope you can illustrate my question.
Updatewithresponse(explanationofGomieroinresponsepostedbelow)
ShareCode