case 6: {cout<<"\n\t 返 回 上 级 菜 单!";goto begin;}
default: {cout<<"\n\t错误选择!重新选择!\n";goto strat;}
}
}
}
1.闰年判断函数
int GetLeap( int year )
{ int leap;
if ((year%400==0)||(year%4==0 && year%100!=0)) return leap=1;
else return leap=0;
}*/
2.星期几计算
week(int year,int month)
{ int differ=year+(year-1)/4-(year-1)/100+(year-1)/400;
int leap;
if ((year%400==0)||(year%4==0 && year%100!=0)) leap=1;
else leap=0;
int acc=AccDays[leap][month];
differ=differ+acc;
int date=differ%7;
return date;}
3.日历显示程序
SolarShow(int SolarYear ,int SolarMonth,string sFile)
{
start:
int c=cin.rdstate();char buf[100];
while(c)
{
cin.clear();cin.getline(buf,80);
cout<<"\n\t非法输入 !重新输入:";
cin>>SolarYear;cin>>SolarMonth;
c=cin.rdstate();
}
//判断年月范围
while((SolarYear<FIRSTYEAR||SolarYear>LASTYEAR)&&(SolarMonth<1||SolarMonth>12))
//{do
{cout<<"\n\t出错!年份范围(1936—2031)";
cout<<"\n\t出错!月份范围(1—12)";
cout<<"\n\t重输年月份(用空格格开):";
cin>>SolarYear;cin>>SolarMonth;goto start;
//}while((SolarYear<FIRSTYEAR||SolarYear>LASTYEAR)&&(SolarMonth<1||SolarMonth>12));
}
while ((SolarYear<FIRSTYEAR)||(SolarYear>LASTYEAR))
//{do
{cout<<"\n\t出错!年份范围(1936—2031)";
cout<<"\n\t重输年月份(用空格格开):";
cin>>SolarYear;cin>>SolarMonth;goto start;
//}while((SolarYear<FIRSTYEAR)||(SolarYear>LASTYEAR));
}
while ((SolarMonth<1)||(SolarMonth>12))
//{do
{cout<<"\n\t出错!月份范围(1—12)";
cout<<"\n\t重输年月份(用空格格开):";
cin>>SolarYear;cin>>SolarMonth;goto start;
//}while((SolarMonth<1)||(SolarMonth>12));
}
static char *cLunarMonth[14]={"0","正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","冬月","腊月","正月"};
/*农历日*/
static char *cSolarMonth[13]={"0","(1~19)山羊 (20~31)水瓶","(1~18)水瓶 (19~28)双鱼",
&nbs
首页 上一页 3 4 5 6 7 8 下一页 尾页 6/8/8
免费资料文档--万年历设计(六)由毕业论文网(www.huoyuandh.com)会员上传。