Skip to content

Instantly share code, notes, and snippets.

@aliyome
Created October 22, 2014 10:32
Show Gist options
  • Save aliyome/124af830860e0c4708dc to your computer and use it in GitHub Desktop.
Save aliyome/124af830860e0c4708dc to your computer and use it in GitHub Desktop.
プロ生のアレ
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