简易的万年历程序C语言

#include
#include


	int boolen(int y)
	{
		int c;
		if((y%400==0)||((y%4==0)&&(y%100!=0)))
		c=1;
		else c=0;
		return (c);
	}
	int tianshu(int year,int month)        //计算天数函数
	{
		int i,days;
		i=boolen(year);
			switch(month)
		{case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			days=31; break;
		case 2:if(i)
				   days=29;
			   else days=28;break;
		default:days=30;break;
		}
			return days;
	}
void main()
{
	int i,m,n,totoldays=0,year,month;    //m是循环变量,i是布尔类型,n是天数
	int empty,day[32]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
printf("\t\t\t*********************************\n\t\t\t*\t\t\t\t*\n\t\t\t*\t\t\t\t*\n\t\t\t$        自制精美万年历\t\t$\n\t\t\t*\t\t\t\t*\n\t\t\t*\t\t\t\t*\n\t\t\t*********************************\n\n");   //万年历界面
printf("\t\t\t请输入年份:");
scanf("%d",&year);
printf("\t\t\t请输入月份:");
scanf("%d",&month);
if(year<1900)
	printf("输入年份不能小于1900年,请重新输入\n"),exit(1);
if(boolen(year))
	printf("\t\t\t%d年是闰年,有%d天\n",year,year,month,tianshu(year,month));
else
	printf("\t\t\t%d年是非闰年,%d年%d月有%d天\n",year,year,month,tianshu(year,month));
printf("\n");
printf("\t星期天\t星期一\t星期二\t星期三\t星期四\t星期五\t星期六\n");
for(m=1900;m


你可能感兴趣的:(LearningInWHU)