我编写了一个万年历,求一个方法

来源:百度知道 编辑:UC知道 时间:2024/05/24 06:21:04
就是怎么才可以显示一年的年历,现在就是可以显示一个月的,但是我要是在c控制台下显示一年的年历是怎么弄啊?谁可以帮下,说一下思路就可以。

以当前电脑时间为基准,显示当前年月的日历
可以按左右方向键,翻到上一月或下一月
可以按上下方向键,翻到上一年或下一年
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>

int leap(int year )
{
if ((year %4 == 0) && (year % 100 != 0)
|| (year % 400 == 0))
{
return 1;
}
return 0;
}

void show(int year,int month)
{
const char month_str[][4]={"","Jan","Feb","Mar","Apl",
"May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
const int month_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i,j,wdays,mdays,days;

for(i=1,days=0;i<year;i++)
{
if(leap(i))
{
days += 366;
}
else
{
days += 365;
}
}
for(i=1;i<month;i++)
{
if(i==2 && leap(year))
{