mardi 4 juillet 2017

c++ if else statement won't go right pathway for text adventure game, always goes to the same Void Function

I have c++ issues. On a text adventure game I am making, and on a part where I have choices for different options on what to do in a house, every choice I make always goes to the sleep void:

void Home()
{
    cout << "\nYou are in the living room of your rented home. Everything looks nice and tidy." << endl;
    cout << "Choices:" << endl;
    cout << "Sleep" << endl;
    cout << "Leave" << endl;
    cout << "Stats" << endl;
    cin >> choice;

    if (choice == "Sleep" || "sleep")
    {
        Sleep(); // No matter what choice I make, it always
        goes to the Sleep(); void.
    }
    if (choice == "Leave" || choice == "leave") {
        TownSquare();
    } if (choice == "Stats" || choice == "stats") {
        StatsH();
    }
    else {
        cout << "Please choose correctly!" << endl;
        Home();
    }
}

All help will be much appreciated. Thank you!

Aucun commentaire:

Enregistrer un commentaire