lundi 14 décembre 2015

C++ if/else undeclared identifier, trying to use words.

I'm trying to make a little game, and I'm a beginner.

#include <iostream>
#include <string>


using namespace std; 

int main()
{
string playerName;
int age;
int playerGender; 

The problem is the parts with the ifs and the else, where it says "Lady" and "Sir". cout << "Are you a Lady or a Sir?" << endl; cin >> playerGender;

    if (playerGender = Lady)
    {
    cout << "So you're a girl. " << endl;
    }
    else if (playerGender = Sir)
    {
    cout << "So you're a boy." << endl;
    }
    cout << "What is your name " << playerGender << "?" << endl;
    cin >> playerName;

    cout << "What is your age?" << playerName << endl;
    cin >> age;

    if (age <= 10)
    {
    cout << "You're too young " << playerName << "! " << endl;
    }
    else if (age >= 11)
    {
    cout << "You are old enough to play" << playerName << ". " << endl;

That's what I have, I don't know whats wrong. Help please!

Aucun commentaire:

Enregistrer un commentaire