C++ program to take birth year and tells age
Following program shows you how to take birth year and tells age.
In this program we get birth year from user and tells their age using currentYear - birthYear
#include <iostream>
int main() {
int birthYear;
std::cout << "Please enter your birth year:";
std::cin >> birthYear;
int age = 2018 - birthYear;
std::cout << "Your age is: " << age;
}
Output:
Please enter your birth year: 2002
Your age is: 16