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.
|
|
|
|
#define MAIN_H
|
|
|
|
|
#include "stdio.h"
|
|
|
|
|
#include "math.h"
|
|
|
|
|
#include "stdlib.h"
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡijһ<C4B3><D2BB><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int monthday(int,int );
|
|
|
|
|
|
|
|
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD> ,<2C>Ƿ<EFBFBD><C7B7><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>0
|
|
|
|
|
int isleapyear(int );
|
|
|
|
|
|
|
|
|
|
#include<math.h>
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int year,month,days,weekday;
|
|
|
|
|
int i,d;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("please input the year:\n");
|
|
|
|
|
scanf("%d",&year);
|
|
|
|
|
days = year-1+(year-1)/400+(year-1)/4-(year-1)/100;//<2F><><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
for(month=1;month<=12;month++)
|
|
|
|
|
{
|
|
|
|
|
printf("\n--------%d/%d--------\n",year,month);
|
|
|
|
|
printf("sun\tmon\ttues\twed\tthur\tfir\tsat\t\n");//<2F><>ͷ
|
|
|
|
|
i = 1; d = 1;
|
|
|
|
|
weekday = (days + 1)%7; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>
|
|
|
|
|
while(i<=weekday) //<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>Ŀո<C4BF>
|
|
|
|
|
{
|
|
|
|
|
printf("\t");
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while(d<=monthday(month,year)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
weekday = (days + 1)%7;
|
|
|
|
|
if(weekday==6) //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
|
|
|
|
printf("%d\n",d);
|
|
|
|
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B2BBBB><EFBFBD>
|
|
|
|
|
printf("%d\t",d);
|
|
|
|
|
if(d==monthday(month,year))
|
|
|
|
|
printf("\n");
|
|
|
|
|
d++;
|
|
|
|
|
days++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "math.h"
|
|
|
|
|
|
|
|
|
|
int monthday(int month,int year)
|
|
|
|
|
{
|
|
|
|
|
switch(month)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
case 3:
|
|
|
|
|
case 5:
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 10:
|
|
|
|
|
case 12:
|
|
|
|
|
return 31;break;
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
case 6:
|
|
|
|
|
case 9:
|
|
|
|
|
case 11:
|
|
|
|
|
return 30;break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
if(isleapyear(year))
|
|
|
|
|
{
|
|
|
|
|
return 29;//<2F><><EFBFBD><EFBFBD>29<32><39>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 28;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int isleapyear(int year)
|
|
|
|
|
{
|
|
|
|
|
if((year%4==0)&&(year%100!=0)||(year%400==0))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|