#include <iostream>
#include <ctime>

using namespace std;

int calculateAge(int birthYear, int birthMonth, int birthDay) {
    // Get current date
    time_t t = time(nullptr);
    tm* now = localtime(&t);

    int currentYear = now->tm_year + 1900;
    int currentMonth = now->tm_mon + 1;
    int currentDay = now->tm_mday;

    // Calculate age
    int age = currentYear - birthYear;

    // Adjust for whether birthday has occurred this year
    if (currentMonth < birthMonth || (currentMonth == birthMonth && currentDay < birthDay)) {
        age--;
    }

    return age;
}

int main() {
    int birthYear, birthMonth, birthDay;

    cout << "Enter your birth year: ";
    cin >> birthYear;
    cout << "Enter your birth month (1-12): ";
    cin >> birthMonth;
    cout << "Enter your birth day: ";
    cin >> birthDay;

    int age = calculateAge(birthYear, birthMonth, birthDay);

    cout << "Your age is: " << age << " years old." << endl;

    return 0;
}