Created
October 22, 2014 10:32
-
-
Save aliyome/124af830860e0c4708dc 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
import std.stdio : write, writef, writeln; | |
import std.datetime : Clock, Date; | |
import std.conv : to; | |
void main() { | |
auto t = Clock.currTime(); | |
auto count = t.endOfMonth.day; | |
auto offset = new Date(t.year, t.month, 1).dayOfWeek.to!int; | |
foreach (i; 0 .. offset) { | |
write(" "); | |
} | |
foreach (i; 1 .. count + 1) { | |
writef("%2d", i); | |
write((i + offset) % 7 == 0 ? "\n" : " "); | |
} | |
writeln(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment