写一个比较时间的结构体链表函数,紧缺到时分秒,我自己写的感觉写不下去了,好像麻烦的很,思路对不对?求高手给个编写思路!最好可以清晰的思路!
#include <stdio.h>struct date
{
int year;
int month;
int day;
int hours;
int minutes;
int seconds;
};
bj_time(void)
{
if(time1.year > time2.year)
{
return time1;
}
else if(time1.year == time2.year)
{
if(time1.month > time2.month)
{
return time1;
}
else if(time1.month == time2.month)
{
if(time1.day > time2.day)
{
return time1;
}
else if(time1.day ==time2.day)
{
if(time1.hours > time2.hours)
{
return time1;
}
else if(time1.hours ==time2.hours)
{
if()
}
}
}
}
else (time1.year < time.yaer)
{
return time2;
}
}
main()
{ struct date time1;
struct date time2;
printf("输入日期:");
scanf("%d-%d-%d",&time.year,&time.month,&time.day);
printf("输入时间:")
scanf("%:%d:%d",&time.hours,&time.minutes,&time.seconds);
bj_time(time1)
}
这个是没有写完的!
[ 本帖最后由 泰迪熊 于 2012-9-8 10:03 编辑 ]