You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.1 KiB

6 years ago
#include<stdio.h>
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
void f(year)
{
int year,day;
if(year%4==0&&year%100!=0||year%400==0)
return 1;
else
return 0;
}
void max_day(int year,int month)
{
int month_day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(f(year)==1)
mouth[1]=29;
return month_day[month-1];
}
//year<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void max_day(int year,int month,int day)
{
int sum=0,i;
for(i=1;i<month;i++)
{
sum+=max_day(i);
}
sum+=day;
return sum;
}
//<2F><><EFBFBD>ڼ<EFBFBD>
void Weekday(int year,int month,int day)
{
int count,i,year_day,weekday;
for(i=1;i<year;i++) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
if(f(i)==1)
year_day=366;
else
year_day=365;
count+=year_day;
}
count+=sum;
weekday=count%7;
return weekday;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void output_week(int year,int month,int day)
{
int weekday;
Weekday(year,month,day);
switch(weekday)
{
case 0:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",year,month,day);
break;
case 1:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ\n",year,month,day);
break;
case 2:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>\n",year,month,day);
break;
case 3:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",year,month,day);
break;
case 4:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",year,month,day);
break;
case 5:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",year,month,day);
break;
case 6:
printf("%d/%d/%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",year,month,day);
break;
}
}
//<2F><><EFBFBD><EFBFBD>
void calendar(int year)
{
int i,j,k,l;
for(i=1;i<=12;i++)
{
printf("%d\n",i);
printf("<EFBFBD><EFBFBD> һ <20><> <20><> <20><> <20><> <20><> \n")<EFBFBD><EFBFBD>
for(j=0;j<weekday;j++) //<2F><>ʼλ<CABC><CEBB>
printf(" ") ;
l=1;
for(k=1;k<max_day(l);k++)
{
l++;
printf("%2d",k);
if((k+weekday)%7==0)
printf("\n");
return 0;
}
return 0;
}
}
void main()
{
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
printf("--------------------------ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--------------------------") <EFBFBD><EFBFBD>
printf(" 1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ")<EFBFBD><EFBFBD>
printf(" 2.<2E><><EFBFBD>ڲ<EFBFBD>ѯ")<EFBFBD><EFBFBD>
printf(" 3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")<EFBFBD><EFBFBD>
printf(" 4.<2E>˳<EFBFBD>")<EFBFBD><EFBFBD>
printf("--------------------------ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--------------------------") <EFBFBD><EFBFBD>
int n,year,month,day;
scanf("%d",&n);
switch (n)
{
case 1:
scanf("%d",year);
calendar(year);
}