Calendar: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: added D) |
|||
Line 167: | Line 167: | ||
=={{header|D}}== |
=={{header|D}}== |
||
{{works with|D|2}} |
{{works with|D|2}} |
||
<lang d>import std.stdio, std.datetime, std.string, std.exception, std.conv |
<lang d>import std.stdio, std.datetime, std.string, std.exception, std.conv; |
||
void main() { |
void main() { |
||
Line 176: | Line 176: | ||
enforce(1 <= cols && cols <= 12); |
enforce(1 <= cols && cols <= 12); |
||
auto rows = |
auto rows = 12 / cols + (12 % cols != 0); |
||
auto date = Date(year, 1, 1); |
auto date = Date(year, 1, 1); |
||
auto offs = cast(int)date.dayOfWeek(); |
auto offs = cast(int)date.dayOfWeek(); |