String to int and subtracting

Hello !
I'm studying software development and C++ I have a task, where I have the text file with information about USA presidents. All the lines are as follows:
Washington 1789-1797 2/22/1732 12/14/1799
Obama 2009– 8/4/1961 —
So there's a name, years when the president was in the office, birthdate and the date of death. The spaces between are tabulations ("\t"). So the task now is to get the president's age from this information. Output has to be "Washington lived 67 years old." Or with Obama "Obama is 49 years old." I can do all the reading from the file and so on. I started with creating a vector for all this information but I just do not know how on Earth I can subtract these two strings.
Help !

Thank you !
Can you work out how to get all the numerical values into separate variables?
Last edited on
I got them all except the day of death. Somehow something doesn't let me get the value. I used substr to get the values and then atoi.
Topic archived. No new replies allowed.