Coding Challenges - Dlang or Generic
H. S. Teoh
hsteoh at qfbox.info
Tue Jan 10 05:21:15 UTC 2023
On Tue, Jan 10, 2023 at 03:18:54AM +0000, matheus via Digitalmars-d-learn wrote:
> On Tuesday, 10 January 2023 at 01:22:33 UTC, H. S. Teoh wrote:
> > ...
> >
> > Here's a challenge. Given an input year, for example, "2023",
> > write a program that outputs (for the corresponding year):
> > ...
>
> The layout isn't like yours, I wrote this using a D Online compiler
> and I'm very sleepy right now:
[...]
> Prints:
>
>
> Jan
> su mo tu we th fr sa
> 1 2 3 4 5 6 7
> 8 9 10 11 12 13 14
> 15 16 17 18 19 20 21
> 22 23 24 25 26 27 28
> 29 30 31
>
> Feb
> su mo tu we th fr sa
> 1 2 3 4
> 5 6 7 8 9 10 11
> 12 13 14 15 16 17 18
> 19 20 21 22 23 24 25
> 26 27 28
[...]
Printing it in this format is trivial, and not very interesting. The
interest in the challenge is to lay it out like I posted, side-by-side,
and to do so in a way that the code is clean, maintainable, and
consists of reusable components. That's where the challenge lies.
T
--
If you think you are too small to make a difference, try sleeping in a closed room with a mosquito. -- Jan van Steenbergen
More information about the Digitalmars-d-learn
mailing list