Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Looking for code that can be returned and calculated to find a person's current age without hard coding the year in the header file.

What I have tried:

this works but my instructor said to not hard code the year...

int DemographicInformation::getAge( )
{
return (2016 - (dateOfBirth%10000));
}
Posted
Updated 26-Nov-16 5:27am

1 solution

Check this out: C++ Date and Time[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900