-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (28 loc) · 836 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (28 loc) · 836 Bytes
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
#include <iostream>
using namespace std;
int main() {
string 1st;
char last;
int birthYear;
int birthMonth;
const int currentMonth = 9;
const int currentYear = 2026;
double months;
bool birthday passed;
cout << "Enter your first name: ";
cin >> 1st;
cout << "Enter your last initial: ";
cin >> last;
cout << "Enter your birth year (YYYY): ";
cin >> birthYear;
cout << "Enter your birth month (1-12): ";
cin >> birthMonth;
cout << "SUMMARY\n";
cout << 1st << " " << last << ".:\n";
(currentYear - birthYear) * 12 + (currentMonth - birthMonth);
cout << "About " << months << " months old.\n";
cout << "Result: " << (currentYear - birthYear)/currentYear;
cout << " plus " << (currentYear - birthYear)%currentYear << endl;
birthday passed = (currentMonth > birthMonth);
return 0;
}