I can't seem to figure out to sort this problem.
I've load up a bunch of actors and presidents into a vector call people.
1732 2 22 1789 4 30 George Washington
Actor John Cusack 1966 6 28 2012
Now what I'm trying to do is sort the vector by the date of birth. On the president's data there are 2 dates. One of them is the date of birth and the other is their term start. Both class are a subclass of person. I store the date as a date object to the vector.
So, how do I compare the birthday from the vector?
PHP Code:
for(int i = 0; i < people.size();i++)
for(int j = i+1; j < people.size(); j++)
{
if(people[i] > people[j])
std::swap(people[i],people[j]);
}
}