1380 lines
26 KiB
C++
1380 lines
26 KiB
C++
#include<bits\stdc++.h>
|
|
using namespace std;
|
|
int w;
|
|
int weekjudge(int d, int m, int y)
|
|
{
|
|
if (m == 1 || m == 2)
|
|
{
|
|
m = (m == 1 ? 13 : 14);
|
|
y--;
|
|
}
|
|
w = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400 + 1) % 7;
|
|
if ((y < 1582) || (y == 1582 && m < 10) || (y == 1582 && m == 10 && d <= 4))
|
|
{
|
|
switch (w)
|
|
{
|
|
case 1:
|
|
w = 4;
|
|
break;
|
|
case 2:
|
|
w = 5;
|
|
break;
|
|
case 3:
|
|
w = 6;
|
|
break;
|
|
case 4:
|
|
w = 0;
|
|
break;
|
|
case 5:
|
|
w = 1;
|
|
break;
|
|
case 6:
|
|
w = 2;
|
|
break;
|
|
case 0:
|
|
w = 3;
|
|
break;
|
|
}
|
|
}
|
|
return w;
|
|
}
|
|
int yearjudge(int y)
|
|
{
|
|
if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
int main()
|
|
{
|
|
start:
|
|
cout << "1.输入具体日期,查询对应的星期以及该年份是否为闰年" << endl;
|
|
cout << "2.输入年份,显示对应的日历" << endl;
|
|
cout << "3.退出" << endl << endl;
|
|
string a;
|
|
cin >> a;
|
|
//1.输入具体日期,查询对应的星期以及该年份是否为闰年
|
|
if (a == "1")
|
|
{
|
|
int y, m, d, c;
|
|
on1:
|
|
double g;
|
|
cout << "请输入年份:" << endl;
|
|
cin >> g;
|
|
y = static_cast<int>(g);
|
|
if (y < 0 || cin.fail() || y != g)
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on1;
|
|
}
|
|
on2:
|
|
cout << "请输入月份:" << endl;
|
|
cin >> g;
|
|
m = static_cast<int>(g);
|
|
if (m < 1 || m > 12 || cin.fail() || m != g)
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on2;
|
|
}
|
|
on3:
|
|
int h;
|
|
h = yearjudge(y);
|
|
cout << "请输入日期:" << endl;
|
|
cin >> g;
|
|
d = static_cast<int>(g);
|
|
if (h == 1 && m == 2 && (d < 1 || d > 29 || cin.fail() || d != g))
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on3;
|
|
}
|
|
else if (h == 0 && m == 2 && (d < 1 || d > 28 || cin.fail() || d != g))
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on3;
|
|
}
|
|
else if ((m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) && (d < 1 || d > 31 || cin.fail() || d != g))
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on3;
|
|
}
|
|
else if ((m == 4 || m == 6 || m == 9 || m == 11) && (d < 1 || d > 30 || cin.fail() || d != g))
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on3;
|
|
}
|
|
else if (y == 1582 && m == 10 && (d < 1 || (d > 4 && d < 15) || d>31 || cin.fail() || d != g))
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto on3;
|
|
}
|
|
c = weekjudge(d, m, y);
|
|
switch (c)
|
|
{
|
|
case 0:
|
|
cout << y << "年" << m << "月" << d << "日为星期日" << endl;
|
|
break;
|
|
case 1:
|
|
cout << y << "年" << m << "月" << d << "日为星期一" << endl;
|
|
break;
|
|
case 2:
|
|
cout << y << "年" << m << "月" << d << "日为星期二" << endl;
|
|
break;
|
|
case 3:
|
|
cout << y << "年" << m << "月" << d << "日为星期三" << endl;
|
|
break;
|
|
case 4:
|
|
cout << y << "年" << m << "月" << d << "日为星期四" << endl;
|
|
break;
|
|
case 5:
|
|
cout << y << "年" << m << "月" << d << "日为星期五" << endl;
|
|
break;
|
|
case 6:
|
|
cout << y << "年" << m << "月" << d << "日为星期六" << endl;
|
|
break;
|
|
}
|
|
if (yearjudge(y) == 1)
|
|
cout << y << "年是闰年" << endl << endl;
|
|
else if(yearjudge(y) == 0)
|
|
cout << y << "年不是闰年" << endl << endl;
|
|
goto start;
|
|
}
|
|
//2.输入年份,显示对应的日历
|
|
else if (a == "2")
|
|
{
|
|
int l, b, y;
|
|
in1:
|
|
double g;
|
|
cout << "请输入年份:" << endl;
|
|
cin >> g;
|
|
l = static_cast<int>(g);
|
|
if (l < 0 || cin.fail() || l != g)
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto in1;
|
|
}
|
|
in2:
|
|
cout << "请选择输出方式:" << endl;
|
|
cout << "1.单列输出" << endl;
|
|
cout << "2.双列输出" << endl;
|
|
cin >> g;
|
|
b = static_cast<int>(g);
|
|
if ((b != 1 && b != 2)|| cin.fail() || b != g)
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "输入错误,请重新输入" << endl;
|
|
goto in2;
|
|
}
|
|
//1.单列输出
|
|
if (b == 1)
|
|
{
|
|
int k;
|
|
y = l;
|
|
if (yearjudge(y) == 1)
|
|
k = 29;
|
|
else
|
|
k = 28;
|
|
cout << "\t " << y << endl;
|
|
int m, d;
|
|
for (int i = 1; i <= 12; i++)
|
|
{
|
|
y = l;
|
|
if (i == 1)
|
|
cout << " January" << endl;
|
|
if (i == 2)
|
|
cout << " February" << endl;
|
|
if (i == 3)
|
|
cout << " March" << endl;
|
|
if (i == 4)
|
|
cout << " April" << endl;
|
|
if (i == 5)
|
|
cout << " May" << endl;
|
|
if (i == 6)
|
|
cout << " June" << endl;
|
|
if (i == 7)
|
|
cout << " July" << endl;
|
|
if (i == 8)
|
|
cout << " August" << endl;
|
|
if (i == 9)
|
|
cout << " September" << endl;
|
|
if (i == 10)
|
|
cout << " October" << endl;
|
|
if (i == 11)
|
|
cout << " November" << endl;
|
|
if (i == 12)
|
|
cout << " December" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
m = i;
|
|
d = 1;
|
|
int c = weekjudge(d, m, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
|
|
{
|
|
m = i;
|
|
for (int j = 1; j <= 31; j++)
|
|
{
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 32)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d, m, y);
|
|
if (c == 6 && d != 31)
|
|
{
|
|
cout << endl;
|
|
if (j < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 9 && j < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (y == 1582 && m == 10 && j == 4)
|
|
{
|
|
cout << "\b";
|
|
j = 14;
|
|
d = 15;
|
|
continue;
|
|
}
|
|
d++;
|
|
}
|
|
cout << endl;
|
|
}
|
|
else if (i == 4 || i == 6 || i == 9 || i == 11)
|
|
{
|
|
m = i;
|
|
for (int j = 1; j <= 30; j++)
|
|
{
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 31)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d, m, y);
|
|
if (c == 6 && d != 30)
|
|
{
|
|
cout << endl;
|
|
if (j < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 9 && j < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d++;
|
|
}
|
|
cout << endl;
|
|
}
|
|
else
|
|
{
|
|
m = i;
|
|
for (int j = 1; j <= k; j++)
|
|
{
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < k+1)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d, m, y);
|
|
if (c == 6 && d != k)
|
|
{
|
|
cout << endl;
|
|
if (j < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 9 && j < k+1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d++;
|
|
}
|
|
cout << endl;
|
|
}
|
|
}
|
|
goto start;
|
|
}
|
|
//2.双列输出
|
|
else if (b == 2)
|
|
{
|
|
int k;
|
|
y = l;
|
|
if (yearjudge(y) == 1)
|
|
k = 29;
|
|
else
|
|
k = 28;
|
|
cout << "\t " << y << endl;
|
|
int i = 1, j = 1;
|
|
int m1, m2, d1, d2;
|
|
cout << " January February" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
d1 = 1;
|
|
m1 = 1;
|
|
d2 = 1;
|
|
m2 = 2;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 31; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < k+1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= k; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < k+1)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != k)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == k)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 31)
|
|
{
|
|
d1 = 31;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= k; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != k)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
cout << " March April" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
i = 1, j = 1, d1 = 1, d2 = 1, m1 = 3, m2 = 4;
|
|
c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 31; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= 30; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 31)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 30)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == 30)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 31 && d2 != 30)
|
|
{
|
|
d1 = 31;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= 30; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 30)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
cout << " May June" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
i = 1, j = 1, d1 = 1, d2 = 1, m1 = 5, m2 = 6;
|
|
c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 31; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= 30; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 31)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 30)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == 30)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 31 && d2 != 30)
|
|
{
|
|
d1 = 31;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= 30; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 30)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
cout << " July August" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
i = 1, j = 1, d1 = 1, d2 = 1, m1 = 7, m2 = 8;
|
|
c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 31; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= 31; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 32)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == 31)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 31 && d2 != 31)
|
|
{
|
|
d1 = 31;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= 31; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
cout << " September October" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
i = 1, j = 1, d1 = 1, d2 = 1, m1 = 9, m2 = 10;
|
|
c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 30; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 31)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= 31; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 32)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
if (y == 1582 && m2 == 10 && j == 4)
|
|
{
|
|
cout << "\b";
|
|
j = 14;
|
|
d2 = 15;
|
|
continue;
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == 31)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 30 && d2 != 31)
|
|
{
|
|
d1 = 30;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= 31; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
c = weekjudge(d1, m1, y);
|
|
if (y==1582 && m2==10 && i == 29)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
}
|
|
cout << endl;
|
|
cout << " November December" << endl;
|
|
cout << "Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat" << endl;
|
|
i = 1, j = 1, d1 = 1, d2 = 1, m1 = 11, m2 = 12;
|
|
c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (i; i <= 30; i++)
|
|
{
|
|
if (i >= 1 && i < 9)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
else if (i >= 9 && i < 31)
|
|
{
|
|
cout << i << " ";
|
|
}
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 6)
|
|
{
|
|
if (i >= 1 && i < 10)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 10 && i < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (j < 10 && j != 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (j >= 10 && j < 32)
|
|
{
|
|
cout << " ";
|
|
}
|
|
if (i == 9 && c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
for (j; j <= 31; j++)
|
|
{
|
|
if (j == 1)
|
|
{
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 0)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 1)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 2)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 4)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 5)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (c == 6)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
if (j >= 1 && j < 9)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
else if (j >= 9 && j < 32)
|
|
{
|
|
cout << j << " ";
|
|
}
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
j++;
|
|
d2++;
|
|
cout << endl;
|
|
break;
|
|
}
|
|
if (j == 31)
|
|
{
|
|
cout << endl;
|
|
}
|
|
d2++;
|
|
}
|
|
if (i < 9)
|
|
{
|
|
cout << " ";
|
|
}
|
|
else if (i >= 9 && i < 31)
|
|
{
|
|
cout << " ";
|
|
}
|
|
}
|
|
d1++;
|
|
if (i == 30 && d2 != 31)
|
|
{
|
|
d1 = 30;
|
|
int c = weekjudge(d1, m1, y);
|
|
if (c == 0)
|
|
cout << " ";
|
|
if (c == 1)
|
|
cout << " ";
|
|
if (c == 2)
|
|
cout << " ";
|
|
if (c == 3)
|
|
cout << " ";
|
|
if (c == 4)
|
|
cout << " ";
|
|
if (c == 5)
|
|
cout << " ";
|
|
if (c == 6)
|
|
cout << " ";
|
|
cout << " ";
|
|
for (j; j <= 31; j++)
|
|
{
|
|
cout << j << " ";
|
|
int c = weekjudge(d2, m2, y);
|
|
if (c == 6 && d2 != 31)
|
|
{
|
|
cout << endl;
|
|
cout << " ";
|
|
}
|
|
d2++;
|
|
}
|
|
}
|
|
}
|
|
cout << endl;
|
|
goto start;
|
|
}
|
|
}
|
|
else if (a == "3")
|
|
{
|
|
goto end1;
|
|
}
|
|
else
|
|
{
|
|
cout << "输入有误" << endl << endl;
|
|
goto start;
|
|
}
|
|
end1:
|
|
return 0;
|
|
} |