I'm trying to make a program wherein the user will input his/her birthday and the program will compute how many days, months, years, hours and minutes they've lived.
I've searched Google and I see there's a way to split the date into three to four parts.
I've copied this code and it seems to be working. It's just that I don't understand it. All the forums I've read don't help much either. Can anyone explain it to me?
time_t t = time(NULL);
tm* timePtr = localtime(&t);
cout << "seconds= " << timePtr->tm_sec << endl;
cout << "minutes = " << timePtr->tm_min << endl;
cout << "hours = " << timePtr->tm_hour << endl;
cout << "day of month = " << timePtr->tm_mday << endl;
cout << "month of year = " << timePtr->tm_mon << endl;
cout << "year = " << timePtr->tm_year + 1900 << endl;
cout << "weekday = " << timePtr->tm_wday << endl;
cout << "day of year = " << timePtr->tm_yday << endl;
cout << "daylight savings = " << timePtr->tm_isdst << endl;