#include "string"
#include "iomanip"
using namespace std;
int monthdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};
string weekday[7]={"星期天","星期一","星期二","星期三","星期四","星期五","星期六"};
string monthname[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
string tiangan[10]={"甲","乙","丙","丁","戊","己","庚","辛","壬","癸"};
string dizhi[12]={"子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"};
string shengxiao[12]={"鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"};
void showcalendar(int f);
void showpermoncal(int mon,int monthweek,int flag);
int main()
{
int f;
cout<<"请选择操作:"<
showcalendar(f);
return 0;
}
void showcalendar(int f)
{
int year,month,day;
int flag=0,mon=1;
int monthweek,week;
int totaldays;
int T,D,S;//天干,地支,生肖
cout<<"请输入年份: ";
cin>>year;
totaldays=(year-1)*365+(year-1)/4+(year-1)/400-(year-1)/100;
week=(totaldays+1)%7;
monthweek=week;
T=(year+6)%10;
D=(year+8)%12;
S=D;
if((year%4==0&&year%100!=0)||(year%400==0)) flag=1;
cout<
{
cout<<"请输入月份: ";
cin>>month;
if(f==3)
{
cout<<"请输入日期: ";
cin>>day;
while(mon
if(month>2&&flag) totaldays++;
totaldays=totaldays+day-1;
week=(totaldays+1)%7;
cout<
}
while(mon<=12)
{
if(mon==month)
{showpermoncal(mon,monthweek,flag); break;}
if(mon==2&&flag) monthweek++;
monthweek=(monthweek+monthdays[mon++-1])%7;
}
return;
}
while(mon<=12)
{
showpermoncal(mon,monthweek,flag);
if(mon==2&&flag) monthweek++;
monthweek=(monthweek+monthdays[mon++-1])%7;
}
}
void showpermoncal(int mon,int monthweek,int flag)
{
cout<
cout<
if(mon==2&&flag) cout<<"29";
cout<