|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
int printfweek()
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD>һ","<EFBFBD>ܶ<EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
int yearr(int year)
|
|
|
|
|
{
|
|
|
|
|
if (year%4==0&&year%100||year%400==0)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int tian(int month,int year)
|
|
|
|
|
{
|
|
|
|
|
int day;
|
|
|
|
|
switch (month)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
case 3:
|
|
|
|
|
case 5:
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 10:
|
|
|
|
|
case 12:day=31;break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 6:
|
|
|
|
|
case 9:
|
|
|
|
|
case 11:day=30;break;
|
|
|
|
|
case 2:{
|
|
|
|
|
if(year%400==0||(year%4==0&&year%100!=0))
|
|
|
|
|
day=29;
|
|
|
|
|
else
|
|
|
|
|
day=28;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return day;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int prifirst(int month,int year)
|
|
|
|
|
{
|
|
|
|
|
int b;
|
|
|
|
|
if (month<3)
|
|
|
|
|
{
|
|
|
|
|
month=month+12;
|
|
|
|
|
year--;
|
|
|
|
|
}
|
|
|
|
|
b=(1+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7;
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
int prtmonth(int month)
|
|
|
|
|
{
|
|
|
|
|
switch (month)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("%26s\n","һ<EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 2:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 3:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 4:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 5:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 6:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 7:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 8:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 9:printf("%26s\n","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 10:printf("%26s\n","ʮ<EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 11:printf("%26s\n","ʮһ<EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 12:printf("%26s\n","ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
{ int a;
|
|
|
|
|
int year,month,i,c,week;
|
|
|
|
|
printf("1:<3A><>ѯijһ<C4B3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n2:<3A><>ѯij<D1AF><C4B3>ij<EFBFBD><C4B3><EFBFBD>м<EFBFBD><D0BC><EFBFBD>\n3:<3A><>ѯij<D1AF><C4B3><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>еĵڼ<C4B5><DABC><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>\n") ;
|
|
|
|
|
scanf("%d",&a);
|
|
|
|
|
switch(a)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n:");
|
|
|
|
|
scanf("%d",&year);
|
|
|
|
|
for (month=1; month<=12; month++) {
|
|
|
|
|
c=1;
|
|
|
|
|
prtmonth(month);
|
|
|
|
|
printfweek();
|
|
|
|
|
week=prifirst(month,year);
|
|
|
|
|
if (week!=6)
|
|
|
|
|
for (i=0; i<=week; i++) {
|
|
|
|
|
printf("\t");
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
for (i=1; i<=tian(month,year); i++,c++)
|
|
|
|
|
{
|
|
|
|
|
printf("%d\t",i);
|
|
|
|
|
if (c%7==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
case 2:int day;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>\n");
|
|
|
|
|
scanf("%d%d",&year,&month);
|
|
|
|
|
day=tian(month,year);
|
|
|
|
|
printf("%d<><64>%d<><64><EFBFBD><EFBFBD>%d<><64>",year,month,day);
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
case 3:int flag=0,le,sum;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>գ<EFBFBD>\n");
|
|
|
|
|
scanf("%d%d%d",&year,&month,&day);
|
|
|
|
|
switch(month)
|
|
|
|
|
{ case 1:sum=0;break;
|
|
|
|
|
case 2:sum=31;break;
|
|
|
|
|
case 3:sum=59;break;
|
|
|
|
|
case 4:sum=90;break;
|
|
|
|
|
case 5:sum=120;break;
|
|
|
|
|
case 6:sum=151;break;
|
|
|
|
|
case 7:sum=181;break;
|
|
|
|
|
case 8:sum=212;break;
|
|
|
|
|
case 9:sum=243;break;
|
|
|
|
|
case 10:sum=273;break;
|
|
|
|
|
case 11:sum=304;break;
|
|
|
|
|
case 12:sum=334;break;
|
|
|
|
|
default:flag=1;
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
{
|
|
|
|
|
sum=sum+day;
|
|
|
|
|
if(year%400==0||(year%4==0&&year%100!=0))
|
|
|
|
|
le=1;
|
|
|
|
|
else
|
|
|
|
|
le=0;
|
|
|
|
|
if(le=1&&month>2)
|
|
|
|
|
sum++;
|
|
|
|
|
printf("%d<><64>%d<><64><EFBFBD><EFBFBD>%d<><64><EFBFBD>ĵ<EFBFBD>%d<><64>",month,day,year,sum);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|