lundi 22 août 2016

using a if statement to see if the user put in the correct string

Not sure how to make sure the user puts in the correct string in the console and then have it relate to the correct if statement. I'm also not sure how to assign damage values or armour values to agility, strength, intelligence so that they affect the character other then just a integer.

      class Character {
public:
    string name;
    string gender;
    string type;
    int strength;
    int agility;
    int intelligence;
    int level;
    int health;
    int experience;
    int mainweapon;
    int offhand;
    int chest;
    int legarmor;
    int gloves;
    int helmet;
    int gold;
    int faction;
};


int main()
{
    Character Charactername;
    Character Charactergender;
    Character Charactertype;
    Character Characteragility;
    Character Characterstrength;
    Character Characterintelligence;
    cout << "what is your name?\n";
    cin >> Charactername.name;
    cout << "Male or Female\n";
    cin >> Charactergender.gender;
    cout << "What class are you, Warrior, Mage or Rogue\n";
    cin >> Charactertype.type;
    cout << "Welcome to the Elysium " << Charactername.name;
    Sleep(5000);

    Character Characterhealth;
    Characterhealth.health = 100;
    if (Charactertype.type == "Warrior","warrior")
        Characteragility.agility = 6, Characterstrength.strength = 10, Characterintelligence.intelligence = 4;
    else if (Charactertype.type == "Mage","mage")
        Characteragility.agility = 4, Characterstrength.strength = 6, Characterintelligence.intelligence = 10;
    else if (Charactertype.type == "Rogue", "rogue")
        Characteragility.agility = 10, Characterstrength.strength = 4, Characterintelligence.intelligence = 6;
    else cout << "you have entered a invalid name" << main;
    cout << Characteragility.agility << endl << Characterstrength.strength << endl << Characterintelligence.intelligence;
    Sleep(2000);
};

Aucun commentaire:

Enregistrer un commentaire