I'm writing a header file for a class project and one of the functions we have to add finds a patient's age from their birth date.
I need to write the function without arguments or any user input and can't use a static date.
I've figured out enough that I have to use the time( ) function to get the current system date I read somewhere that using the localtime( ) function I can convert time_t to a struct tm data type which has all it's various components saved as ints. I also know that I have to add 1 to tm_month to get the real int for the month and 1900 to the year since it's actually saved as years since 1900.
What I need to know is, how do I extract these values for use in our function?
We have the date of birth saved as an int MMDDYYY because that's how the prof wants it... we've already broken the d.o.b. into separate mm dd and yyyy components and just need the current month day and year. We need the current date broken into ints so we can simply subtract them to get the age.
we're using windows vista, and the compiler is I think visual compiler 5.0 '97... or something
OR if there is another way to do this other than using time( ) I'd love to know that, someone in another group said they got the current date using three lines of code
Edited by viziroth: clearical and grammarical