标签:
公式计算蔡勒判断 |
分类: C 编程 |
#include<iostream>
#include<string>
using namespace std;
string CaculateWeekDay(int y,int m,int d);
string get_Month_string(int m);
bool is_valid(int m,int d,int y);
void main()
{
int month,day,year;
cout<<'Enter a date in the form of dd mm yyyy: ';
cin>>day>>month>>year;
if(is_valid(month,day,year))
cout<<CaculateWeekDay(year,month,day)<<endl;
else
cout<<day<<' '<<month<<'
'<<year<<' is an invalid date.'<<endl;
}
string CaculateWeekDay(int y,int m, int d)
{
int week = 0;
if(m==1){m=13;y--;}
if(m==2) {m=14;y--;}
if((y<1752)||((y==1752)&&(m<9))||((y==1752)&&(m==9)&&(d<3)))
//判断