In C++ create a code that Asks for a birth date then compute and display the exact age in a year
#include <iostream>
using namespace std;
int main()
{
int currentYear;
int birthYear;
int age;
cout<<"\nEnter current year: ";
cin>>currentYear;
cout<<"\nEnter birth year: ";
cin>>birthYear;
age=currentYear- birthYear;
cout<<"Age = "<<age<<" years";
return 0;
}
Comments
Leave a comment