Logic to sorting date C++ ?

Hashbrews

New member
Hi,
can someone please help me how to sort date in C++?
just explain me the logic is good enough...
so i want to sort a list of date :

25/Jan/2012
01/Feb/2011
20/Mar/1990
21/Jan/1990

sorted:
21/Jan/1990
20/March/1990
01/Feb/1990
26/Jan/2012

each of the date ,month and array i already stored it inside an int array.

My rough code:

if(year>year[j] && month>month[j] || day>day[j])
{
temp = year;
year=year[j];
year[j]=temp;
temp = goods.date;
goods.date = goods[j].date;
goods[j].date = temp;
}

the date itself i stored inside a structure...
can someone pls help me?
thanks
 
Back
Top