Created
January 9, 2016 07:26
-
-
Save zlsun/f515af6336614747e1e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <iomanip> | |
| #include "date.h" | |
| using namespace std; | |
| using namespace date; | |
| using namespace std::chrono; | |
| int main(int argc, char *argv[]) | |
| { | |
| auto y = 2016_y; | |
| for (auto m = 1; m <= 12; ++m) { | |
| auto b = y / m / 1; | |
| auto e = b + months(1); | |
| cout << string(8, ' ') << b.month() << endl; | |
| const int N = 5 * 7; | |
| int M[N] = {0}; | |
| int i = unsigned(weekday(b)); | |
| days ds = day_point(e) - day_point(b); | |
| for (auto d = 1; d <= ds.count(); ++d) { | |
| M[i++] = d; | |
| } | |
| for (int j = 0; j < N; ++j) { | |
| cout << setw(2); | |
| if (M[j]) cout << M[j]; | |
| else cout << " "; | |
| cout << ((j + 1) % 7 ? ' ' : '\n'); | |
| } | |
| cout << endl; | |
| } | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment