c++ 万年历

来源:百度知道 编辑:UC知道 时间:2024/06/18 04:06:26
我已经知道每月的第一天是星期几 但是要怎么打到相对应的星期下???
发个代码来 谢谢!!!

/*计算1-3000年的一年的日历。可以分屏输出,输出一整年的日历*/
/*文件名:Calendar.c*/

#include <conio.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
/*引用的头文件*/

#define firstdayof1 1
/* 定义公元元年的第一天是星期一=1,而星期日=7 */
#define gap " "
/* 设置日期数字之间的间隔大小*/
#define dent " "
/* 设置日历开始输出的位置离左边框的距离*/
#define maxyear 3000
/*设置年数的最大值*/

struct info {
int month; /*月份*/
int firstdayofmonth; /*本月第一天是星期几*/
int daysofmonth; /*本月的天数*/
int leap; /*是否为闰年*/
}monthinfo;
/*记录月份信息的结构体*/

int checkinput(void); /*检查输入*/
int inputyear(void); /*输入年份*/
int isleap(int y); /*判断闰年*/
void output(struct info); /*输出*/
void printhead(struct info ); /*输出月份开头开头*/
void printmonth(struct info); /*输入月份主体部分*/
struct info setinit(int); /*初始化当年一月份信息*/
struct info