I am very new to C++. I have been reading some tutorial mainly on the cprogramming tutorial page. I wanted to but the very basic things I have learned to use and see if I could create just a little program. I ran into a problem and I looked for the answer but didn't get the answer I need. Here is my code and if you could tell me what I was doing wrong I would be very grateful. I am thinking it may be very off the wall. I just started learning C++ yesterday and I wrote all this without referencing back to anything. When I was done I tried to run it but it didn't work, so I went back and tried to find out what I had wrong but like I said it didn't work. So anways here it is.
Code:
#include <iostream>
using namespace std;
int main()
{
int enteredname;
int sexofchar;
cout<<"Welcome to Lords of the Land. This is a text-based Role-Playing game that will immerse you into a world with countless people to meet and activities to do. You will be able to create your character, hunt with your character, build your character anyway you fancy, join guilds and form alliances, and any other thing your imagination can conjure. Prepare to enter a world of pure imagination!!";
cout<<"First off I need your to pick your Characters name. So if you would please enter your characters name.";
cin>> enteredname;
cin.ignore();
cin.get();
cout<<"From now okay I shall call you "<<enteredname<<"\n";
cout<<"Next I need to know the gender of your character. Please type in either M or F. Letters are case sensitive.";
cin>> sexofchar;
cin.ignore();
cin.get();
if ( sexofchar = M )
{
cout<<"Sir: "<<enteredname<<",I'm glad you could come join us on this Journey.";
}
else if ( sexofchar = F )
{
cout<<"Madam: "<<enteredname<<",I'm glad you could come join us on this Journey.";
}
cin.get();
return 0;
}