Hi, I am having a problem understanding simple if, else, and cin commands. What I want to do is make it so I give the user a choice or a question, and depending on the answer I want the console to display one of two different things. My program is under the post. I just want it so that if the user inputs that he is a boy: it displays "do you like sports." If the user inputs that she is a girl: it displays "whats your favorite hobby. As of now, if I enter 2 for girl, it will still display "do you like sports, rather than ignoring the if statement. If you can tell me what I did wrong it would help me a lot :]. Thanks.
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string name;
string hobby;
string sport;
int x;
int y;
int z;
x=0;
y=x+1;
z=x+2;
cout << "Hello World!" << endl ;
cout << "What Is Your Name?" << endl;
cin >> name;
cout << "Hello " << name << " My Name Is Alex Dryer :)" << endl;
cout << "Are You A Boy Or A Girl?" << endl;
cout << "Press 1 For Boy, Press 2 For Girl." << endl;
cin >> x;
if (y){
cout << "Do You Like Sports?" << endl;
}
else if (z){
cout << "What Is Your Favorite Thing To Do?" << endl;
cin >> hobby;
cout << "Yeah, I Guess " << hobby << " Is Pretty Fun :)" << endl;
}