# problem>

• 07-15-2006
limitmaster
problem>
Hi there this is a very easy problem but i can't get it correctly here's the code;

Code:

```#include <iostream> using namespace std; int main(void) { int yr_of_brth, crnt_yr; cout << "Year of Birth" << endl; cin >> yr_of_brth; cin.ignore(); cout << "\n"; cout << "Current Year" << endl; cin >> crnt_yr; cin.ignore(); cout << "\n"; cout << "your age is: " << abs(yr_of_brth - crnt_yr) << endl; cin.get(); } Output: Year of birth 62 Current Year 99 Your age is: 37 -----another run of the program----- Output: Year of birth 62 Current Year 00 Your age is: 38```
the thing that i dont get is if I input 62 for year of birth and current year for 00 i got a answer of 62 not 38..... how can i get 38 as a answer because this program requires only the last two numbers in year.... any help there? thanks :)
• 07-15-2006
Wraithan
Maybe something like if the current year is less than the birth year add 100 to the current year... haven't tested it and don't plan on it since this is homework, I have had this assignment before. Had me stumped for a while.
• 07-15-2006
limitmaster
thanks mate now i have an idea......
• 07-15-2006
Richie T
Does this sound vaguely like the Y2K bug to anyone else!!?