mardi 30 avril 2019

No matter the input if statement continues on the first "exit"

Working on a text based rpg and im realy confussed why no matter the input it always gives me the same result.

cout << "Human" << endl;
cout << "Ghoul" << endl;
cout << "Super mutant" << endl;
cin >> rase;
cout << "Your input: " << rase << "." << endl;
if (rase == "Human" || "human")
{
    cout << "You are standing at the exit of Vault 101. \n" << endl;
    weapon = 25;
    health = 100;
    MAXhealth = 100;
    system("PAUSE");
}
else if (rase == "Ghoul" || "ghoul")
{
    cout << "You are standing at the Megaton bar selling some drinks. \n" << endl;
    weapon = 50;
    health = 125;
    MAXhealth = 125;
    system("PAUSE");
}
else if (rase == "Super mutant" || "super mutant" || "Super Mutant" || "supermutant")
{
    cout << "You are standing and wishing you had a new weapong to smash stuff with. \n" << endl;
    weapon = 100;
    health = 200;
    MAXhealth = 200;
    system("PAUSE");
}
else
{
    cout << "wrong input" << endl;
}

i have tried to make it with char how ever that has caused alot more errors, atleast while using string i compiles and take in input.

i would like to some how make the program to pick my "race" without just simple 1,2,3 pick for example.

Aucun commentaire:

Enregistrer un commentaire