怎么C语言设计一个查询并打印万年历的程序?苦求答案!请尽量要快....拜谢了!!! 不甚感激!!

来源:百度知道 编辑:UC知道 时间:2024/06/07 13:20:04
步骤:
1画出程序流程图;
2编写程序;
3调试程序,对调试过程中出现的问题进行分析,找出错误的原因并予改正;
4写出通过调试并修改正确的原程序。
【要求】:
1. 程序运行后,首先在屏幕上显示主菜单:
1. 查询某年某月某日是星期几
2. 查询某年是否是闰年
3. 打印某年的全年日历
4. 退出

2. 在主菜单中输入1后,显示:
“请输入年月日(XXXX,XX,XX)”
运行后输出:XXXX年XX月XX日是星期X,是否继续查询(Y/N)?
如果输入Y,则重新显示 “请输入年月日(XXXX,XX,XX)”,否则回到主菜单。

3. 在主菜单中输入2后,显示:
“请输入要查哪一年?(XXXX)”
运行后输出:XXXX年是(否)是闰年,是否继续查询(Y/N)?
如果输入Y,则重新显示,“请输入要查哪一年?(XXXX)”,否则回到主菜单。

4. 在主菜单中输入3后,显示:
“请输入要打印的年份(XXXX)”
运行后输出XXXX年的日历,格式为:
XXXX
X(月数)
0 1 2 3 4 5 6
S M T W T F S
x x x x x x x
x x x xx xx xx xx
xx xx xx xx xx xx xx
xx xx xx xx

#include "conio.h"
void main()
{
for(;;)
{ int h,i,j,k,z=0,s,l,x;
int day=0,zday;
int year,years;
int month_day[]={31,28,31,30,31,30,31,31,30,31,30,31};
int month_day2[]={31,29,31,30,31,30,31,31,30,31,30,31};
int jd[]={1,2,3,5};
printf("Please enter the year(1990-2090),or 0 to exit :");
scanf("%d",&year);

if(year==0)
break;

if(year<1980 || year>2099)
{ printf("error\n");
printf("any enter to exit\n");
getch();
break;
}

printf("Please enter the month,or 0 to exit :");
scanf("%d",&j);

if(j==0)
break;

if(j<0 || j>12)
{ printf("error\n");
printf("any enter to exit\n");
getch();
break;
}

printf("---------------------------\n");
switch( j )