samedi 24 juin 2017

c++ Wan't to go back to the void on if else statement

please look at this code, and I will explain

void GameOver()


{
  cout << "\nWelp, you died. Want to try again?" << endl;
cin >> choice;
if (choice == "Yes" || "yes")
{
    **///This is where I want the code. I want it to go back to the last 
void that the player was on.**
}

if (choice == "No" || "no")
{
    cout << "Are you sure? The game will start over when you open it back up." << endl;
    cin >> choice;
    if (choice == "No" || "no")
    {
        cout << "Well, bye now!" << endl;
        usleep(1000000);
        exit (EXIT_FAILURE);
    }
}
return;

}

I would like it so that when I choose "Yes" in the GameOver void, I want an if else statement that says "if you came from this void, then you will go to this void, you see what I'm saying?

For example, let's say I am in the GameOver void and I came from a FightProcess void. I choose "Yes" then it will go to the Town void. How would I code that?

Thank you!

To moderators: I worked hard on this question so please don't down this question or block it or anything like that. Thanks!

Aucun commentaire:

Enregistrer un commentaire