免费毕业论文--万年历设计(一)信息工程毕业(6)
2013-06-13 01:23
导读:larShow(Year,Month,sFile);goto strat;} case 6: {cout"\n\t 返 回 上 级 菜 单!";goto begin;} default: {cout"\n\t错误选择!重新选择!\n";goto strat;} } } } 1.闰年判断函数 int GetLea
larShow(Year,Month,sFile);goto strat;}
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)";
(科教作文网http://zw.NSEaC.com编辑发布)
cout<<"\n\t重输年月份(用空格格开):";
cin>>SolarYear;cin>>SolarMonth;goto start;
/