Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- 2 using namespace std;
- 3 int main()
- 4 {
- 5 cout << "Enter the name of the person you want to write too (followed by 'enter'): " << flush;
- 6 string first_name; // first_name is a variable
- 7 cin >> first_name;
- 8 cout << "Dear," << first_name << "!" << endl;
- 9 cout << "How are you doing? I am fine but I miss you terribly." << endl;
- 10 cout << "I am fine these days just busy with work is all." << endl;
- 11 cout << "Seems like I am doing good with my weight loss though." << endl;
- 12 cout << "I am eating healthy and exercising 5 days a week." << endl;
- 13 cout << "What is your other friends name ? "<< flush;
- 14 string friend_name;
- 15 cin >> friend_name;
- 16 cout << "How is " << friend_name << " doing these days? " << endl;
- 17 cout << "Have you seen " << friend_name << " lately? " << endl;
- 18 char(0); // still not sure if this helps or not yet. Confused on it a bit
- 19 cout << "Please tell me if your friend is male(m) or female(f) (followed by 'enter') ." << endl;
- 20 string input;
- 21 string male = "m";
- 22 string female = "f";
- 23 cin >> input;
- 24 if(input == male) // finally got this one figured out. Had to remove the ; same as below
- 25 {
- 26 cout << "If you see " << friend_name << " please ask him to call me. " << endl;
- 27 }
- 28 if(input != male) // had to swap the string names above to get it to accept m or f like book says to
- 29 {
- 30 cout << "If you see " << friend_name << " please ask her to call me. " << endl;
- 31 }
- 32 return 0;
- 33 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement