calculating age from date of birth and computer date

I have used the following to acquire the date from the computer and this works great.

char*date;
string reg_date = " ";
time_t todayIs = time(0); //generate a time element
date = ctime(&todayIs); //get the current date and time
reg_date = _strdate(date); //express the date in the form mm/dd/yy

My program asks for the user to input his/her date of birth. After this line the age should be calculated using the date of birth and the date extracted from the computer.
I have tried different things and I have had no luck what so ever. I would greatly appreciate any help that can be offered.

Thanks a mil.
http://www.cplusplus.com/reference/ctime/time/

The example on that page should do exactly want you want with a little modification. You might also want to take a look at struct tm.

http://www.cplusplus.com/reference/ctime/tm/
Topic archived. No new replies allowed.