I am trying to get the user to enter an m for male or f for female and then store it into friend_sex then run that character through an if statement which will out output one of the two lines depending on the character entered. if anyone can tell me what i am doing wrong it would be greatly appreciated. thank you.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
usingnamespace std;
inlinevoid keep_window_open() {char ch; cin >> ch; }
int main()
{
cout << "Please enter the name of the person you want to write to:\n";
string first_name; // first_name is a variable of type string
cin >> first_name; // friend_name is a variable of type string
cout << "What's the name of one of your best friends?:\n";
string friend_name; // friend_name is a variable of type string
cin >> friend_name; // read characters into friend_name
char friend_sex = 0;
char m, f;
cout << "Enter an m if your friend is male and a f is your friend is female:\n";
cin >> friend_sex;
cout << "Dear " << first_name << ",\n"; // salutation of letter
cout << endl;
cout << " How are you? I am fine. I miss you. When are you coming\n";
cout << "back to visit me. We should get together and have some lunch or something.\n";
cout << "Call me when you get back from vacation and we will work something out!\n";
cout << "Have you seen " << friend_name << " lately?\n";
if (friend_sex == m)
cout << "If you see " << friend_name << " please ask him to call me.\n";
if (friend_sex == f)
cout << "If you see " << friend_name << " please ask her to call me.\n";
}