|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
/*<2A>ж<EFBFBD><D0B6>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>*/
|
|
|
|
|
int R(int year)
|
|
|
|
|
{
|
|
|
|
|
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/*<2A>жϸ<D0B6><CFB8>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
int max_day(int year, int month)
|
|
|
|
|
{
|
|
|
|
|
int day[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
|
|
|
if (R(year) == 1)
|
|
|
|
|
day[1] = 29;
|
|
|
|
|
return day[month - 1];
|
|
|
|
|
}
|
|
|
|
|
/*<2A>жϸ<D0B6><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD>*/
|
|
|
|
|
int total_day(int year, int month, int day)
|
|
|
|
|
{
|
|
|
|
|
int sum = 0;
|
|
|
|
|
int i = 1;
|
|
|
|
|
for (i = 1; i < month; i++)
|
|
|
|
|
sum += max_day(year, i);
|
|
|
|
|
sum += day;
|
|
|
|
|
return sum;
|
|
|
|
|
}
|
|
|
|
|
/*<2A>жϸ<D0B6><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>*/
|
|
|
|
|
int weekday(int year, int month, int day)
|
|
|
|
|
{
|
|
|
|
|
int count;
|
|
|
|
|
count = (year - 1) + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400 + total_day(year, month, day);
|
|
|
|
|
count %= 7;
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
/*<2A><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>*/
|
|
|
|
|
void display_week(int year, int month, int day)
|
|
|
|
|
{
|
|
|
|
|
int count;
|
|
|
|
|
count = weekday(year, month, day);
|
|
|
|
|
switch (count)
|
|
|
|
|
{
|
|
|
|
|
case 0:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 1:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ\n", year, month, day); break;
|
|
|
|
|
case 2:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 3:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 4:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 5:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 6:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*չʾ<D5B9>·ݱ<C2B7><DDB1><EFBFBD>*/
|
|
|
|
|
void display_month(int year, int month, int day)
|
|
|
|
|
{
|
|
|
|
|
int i = 0, j = 1;
|
|
|
|
|
int week, max;
|
|
|
|
|
week = weekday(year, month, 1);
|
|
|
|
|
max = max_day(year, month);
|
|
|
|
|
printf("\n\t\t\t **%d<><64>%d<><64>**",year,month);
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("\n\t<EFBFBD><EFBFBD>\tһ\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
for (i = 0; i < week; i++)
|
|
|
|
|
printf("\t");
|
|
|
|
|
for (j = 1; j <= max; j++)
|
|
|
|
|
{
|
|
|
|
|
printf("\t%d",j);
|
|
|
|
|
if (i % 7 == 6)
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
}
|
|
|
|
|
/*<2A>ж<EFBFBD><D0B6>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void display_festival(int year,int month,int day)
|
|
|
|
|
{
|
|
|
|
|
int ff;
|
|
|
|
|
if(month==1&&day==1)ff=22;
|
|
|
|
|
else if(month==2&&day==14)ff=1;
|
|
|
|
|
else if(month==3&&day==8)ff=2;
|
|
|
|
|
else if(month==3&&day==12)ff=3;
|
|
|
|
|
else if(month==3&&day==15)ff=4;
|
|
|
|
|
else if(month==4&&day==1)ff=5;
|
|
|
|
|
else if(month==5&&day==1)ff=6;
|
|
|
|
|
else if(month==5&&day==12)ff=7;
|
|
|
|
|
else if(month==5&&day==31)ff=8;
|
|
|
|
|
else if(month==6&&day==1)ff=9;
|
|
|
|
|
else if(month==6&&day==5)ff=10;
|
|
|
|
|
else if(month==6&&day==6)ff=11;
|
|
|
|
|
else if(month==6&&day==26)ff=12;
|
|
|
|
|
else if(month==7&&day==1)ff=13;
|
|
|
|
|
else if(month==7&&day==7)ff=14;
|
|
|
|
|
else if(month==8&&day==1)ff=15;
|
|
|
|
|
else if(month==9&&day==10)ff=16;
|
|
|
|
|
else if(month==9&&day==20)ff=17;
|
|
|
|
|
else if(month==10&&day==1)ff=18;
|
|
|
|
|
else if(month==11&&day==8)ff=19;
|
|
|
|
|
else if(month==12&&day==1)ff=20;
|
|
|
|
|
else if(month==12&&day==25)ff=21;
|
|
|
|
|
else ff=0;
|
|
|
|
|
switch(ff)
|
|
|
|
|
{
|
|
|
|
|
case 22:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 1:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 2:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD>ǹ<EFBFBD><C7B9>ʸ<EFBFBD>Ů<EFBFBD><C5AE> \n", year, month, day); break;
|
|
|
|
|
case 3:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 4:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 5:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD> \n", year, month, day); break;
|
|
|
|
|
case 6:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 7:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD>ǹ<EFBFBD><C7B9>ʻ<EFBFBD>ʿ<EFBFBD><CABF>\n", year, month, day); break;
|
|
|
|
|
case 8:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 9:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD>ǹ<EFBFBD><C7B9>ʶ<EFBFBD>ͯ<EFBFBD><CDAF> \n", year, month, day); break;
|
|
|
|
|
case 10:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绷<EFBFBD><E7BBB7><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 11:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>簮<EFBFBD><E7B0AE><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 12:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD>ǹ<EFBFBD><C7B9>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 13:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 14:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 15:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ž<EFBFBD><C5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 16:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>ʦ<EFBFBD><CAA6>\n", year, month, day); break;
|
|
|
|
|
case 17:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 18:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><F1B9B2BA><CDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 19:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD>Ǽ<EFBFBD><C7BC>߽<EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 20:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
case 21:printf("\t%d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD>ʥ<EFBFBD><CAA5><EFBFBD><EFBFBD>\n", year, month, day); break;
|
|
|
|
|
default:printf("\t<EFBFBD><EFBFBD><EFBFBD>첻<EFBFBD><EFBFBD>ɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*<2A>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>ȥ*/
|
|
|
|
|
int rrr(int year, int month, int day)
|
|
|
|
|
{
|
|
|
|
|
int qqq,www,eee,x;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d%d%d",&qqq,&www,&eee);
|
|
|
|
|
if(qqq>year)
|
|
|
|
|
x=1;
|
|
|
|
|
else if(qqq==year&&www>month)
|
|
|
|
|
x=1;
|
|
|
|
|
else if(qqq==year&&www==month&&eee>=day)
|
|
|
|
|
x=1;
|
|
|
|
|
else x=0;
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 0:printf("<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD>ȥ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>\n") ;break;
|
|
|
|
|
case 1:printf("<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int year, month, day;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(yyyy-mm-dd)<29><>");
|
|
|
|
|
scanf("%d%d%d", &year, &month, &day);
|
|
|
|
|
if (month<1||month>12||day<1||day>31)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
printf(" %d<><64>%d<><64>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ĵ<EFBFBD>%d<><64>\n", year, month, day, total_day(year, month, day));
|
|
|
|
|
display_week(year, month, day);
|
|
|
|
|
display_festival(year,month,day);
|
|
|
|
|
display_month(year, month, day);
|
|
|
|
|
rrr(year, month, day);
|
|
|
|
|
system("pause");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|