Hi, i want to calculate age of a person so then i try to make an algorithm which is used in a function like (i know to use math.h for abs())
double age_calculator( int year, int month, int day);
So, my questions are first how can i use current date, i mean i want to use date of present day instead of 2014,25 and 9. I don't know how i can use date of every day.Code:double age_calculator( int year, int month, int day); // p means present(current) int pyear=(2014-year)*365; int pmonth=(abs(9-month))*30; int pday=abs(25-day); return (pyear+pmonth+pday)/365.0;
For instance my function returns 14.74 for the parameters; 2000, 01, 01 (for the current day 25/09/2014)
Thank you for all appreciated answers