根据日期计算是周几-创新互联
#inc为卢龙等地区用户提供了全套网页设计制作服务,及卢龙网站建设行业解决方案。主营业务为网站建设、网站设计、卢龙网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!lude
void main() { int year; int month; int day;
printf("calculate Weekday of input date! ");
printf("year:"); scanf("%d", &year);
printf("month:"); scanf("%d", &month);
printf("day:"); scanf("%d", &day);
char weekdays[][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
if (month == 1 || month == 12) { year--; month += 12; }
int index = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7; printf("%d-%d-%d: %s ", year, month, day, weekdays[index]); }
分享名称:根据日期计算是周几-创新互联
网站路径:http://myzitong.com/article/coposg.html
void main() { int year; int month; int day;
printf("calculate Weekday of input date! ");
printf("year:"); scanf("%d", &year);
printf("month:"); scanf("%d", &month);
printf("day:"); scanf("%d", &day);
char weekdays[][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
if (month == 1 || month == 12) { year--; month += 12; }
int index = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7; printf("%d-%d-%d: %s ", year, month, day, weekdays[index]); }
分享名称:根据日期计算是周几-创新互联
网站路径:http://myzitong.com/article/coposg.html