| htldm 回复于:2003-01-22 14:06:58 |
| #include <time.h>
#include <stdio.h> #include <string> char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Unknown"}; int main(int argc, char* argv[]) { struct tm time_check; int year =2001 ; //年 int month =5; //月 int day =2; //日 /* load the time_check structure with the data */ time_check.tm_year = year - 1900; time_check.tm_mon = month - 1; time_check.tm_mday = day; time_check.tm_hour = 0; time_check.tm_min = 0; time_check.tm_sec = 1; time_check.tm_isdst = -1; /* call mktime to fill in the weekday field of the structure */ if (mktime(&time_check) == -1) time_check.tm_wday = 7; /* print out the day of the week */ printf("That day is a %s\n", wday[time_check.tm_wday]); return 0; } //--------------------------------------------------------------------------- |
| sensir 回复于:2003-01-22 15:24:58 |
| 测试通过 |
| any123 回复于:2003-01-22 16:02:06 |
| 靠!
人家都写得这么明白了,你把参数取到后替换他的2001、5、2不就行了吗? |
| lcz88990200 回复于:2003-01-22 17:13:42 |
| 主要是告诉一个思路就行了,不必百分之百的正确 |
| sensir 回复于:2003-01-22 18:25:16 |
| [quote:3a99448da2="any123"]靠!
人家都写得这么明白了,你把参数取到后替换他的2001、5、2不就行了吗?[/quote:3a99448da2] 您老人家这么激动干什么啊?你是靠你父亲长大的。 我也只是快速的做了个测试,只是对于楼主的要求反映一下情况而已,我是草率了点,但我想我不应该这样草率,因为每一句话大家都是那么认真的对待的。 |
| any123 回复于:2003-01-22 19:12:37 |
| [quote:79b3e6a54f="sensir"]
您老人家这么激动干什么啊?你是靠你父亲长大的。 我也只是快速的做了个测试,只是对于楼主的要求反映一下情况而已,我是草率了点,但我想我不应该这样草率,因为每一句话大家都是那么认真的对待的。[/quote:79b3e6a54f] 好了,我有点激动了,向你道歉。 |
| sensir 回复于:2003-01-22 19:17:55 |
| 如果我有什么不对的,也表示道歉。 |
| htldm 回复于:2003-01-22 19:55:22 |
| 不打不相识,快过年了,走!一起去喝酒!呵呵。 |