-
Notifications
You must be signed in to change notification settings - Fork 4
/
letter_generator.cpp
42 lines (34 loc) · 1.22 KB
/
letter_generator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "Enter the name of the person you want to write to\n";
string first_name;
cin >> first_name;
cout << "Enter the name of another friend\n";
string friend_name;
cin >> friend_name;
cout << "If the friend is male, enter an 'm', or enter an 'f'\n";
char friend_sex = 0;
cin >> friend_sex;
cout << "Please enter the age of the person you want to write to\n";
int age = 0;
cin >> age;
if (age <= 0 || age >= 110)
cerr << "You're kidding!\n";
cout << "Dear " << first_name << ",\n";
cout << " How are you? I am fine. I miss you.\n";
cout << " Have you seen " << friend_name << " lately? ";
if (friend_sex == 'm')
cout << "If you see " << friend_name << " please ask him to call me.\n";
else
cout << "If you see " << friend_name << " please ask her to call me.\n";
if (age < 12)
cout << " Next year you will be " << age + 1 << ".\n";
else if (age == 17)
cout << " Next year you will be able to vote.\n";
else if (age > 70)
cout << " I hope you are enjoying retirement.\n";
cout << "Yours sincerely,\n\n\nZZy";
return 0;
}