بهتر است از کاربر بپرسیم که اکنون چه سالی است؟
#include <iostream.h>
#include <conio.h>
main()
{
int thisyaer,firstyear,secondyear;
cout << "Enter this year's date:\n";
cin>>thisyaer;
cout << "Enter First one and Second one Brith Year:\n";
cin>>firstyear>>secondyear;
firstyear=thisyaer-firstyear;
secondyear=thisyaer- secondyear;
if(firstyear>secondyear)
cout<<"First one is bigger.";
else if(secondyear>firstyear)
cout<<"Second one is bigger.";
else
cout<<"First one and Second one ages are equal.";
getch();
}