比较日期程序,该如何解决

比较日期程序
求助:输入任意个日期,判断哪个日期更早。(能不能不从年份一直比较到日期,太麻烦了)

------解决方案--------------------
可以直接比较字典顺序:strcmp

比如日期1:"2011.1.2"
日期2 :"2012.2.1"


------解决方案--------------------
好像不对

比如:
1022.8.15
984.4.5
------解决方案--------------------
探讨

好像不对

比如:
1022.8.15
984.4.5

------解决方案--------------------
楼主看看这个,我也是个新手,交流一下!!!
#include<stdio.h>
void main()
{
int year1,month1,day1,year2,month2,day2;
long compute(int x,int y,int z);
printf("please enter two date:\n");
scanf("%d/%d/%d,%d/%d/%d",&year1,&month1,&day1,&year2,&month2,&day2);
if( compute(year1,month1,day1) > compute(year2,month2,day2) )
printf("%d/%d/%d earlier than %d/%d/%d\n",year2,month2,day2,year1,month1,day1);
else if( compute(year1,month1,day1) < compute(year2,month2,day2) )
printf("%d/%d/%d earlier than %d/%d/%d\n",year1,month1,day1,year2,month2,day2);
else
printf("the two date is equal\n");
}
long compute(int x,int y,int z)
{
long sumdays;
sumdays=x*365+(y-1)*30+z;
return sumdays;
}
------解决方案--------------------
探讨
引用:
可以直接比较字典顺序:strcmp

比如日期1:"2011.1.2"
日期2 :"2012.2.1"

好办法

------解决方案--------------------
COleDateTime
COleDateTimeSpan
------解决方案--------------------
C++
------解决方案--------------------
探讨
引用:

好像不对

比如:
1022.8.15
984.4.5


哦 是的 我错了:-D