r/dailyprogrammer • u/oskar_s • Apr 23 '12
[4/23/2012] Challenge #42 [easy]
Write a program that prints out the lyrics for "Ninety-nine bottles of beer", "Old McDonald had a farm" or "12 days of Christmas".
If you choose "Ninety-nine bottles of beer", you need to spell out the number, not just write the digits down. It's "Ninety-nine bottles of beer on the wall", not "99 bottles of beer"!
For Old McDonald, you need to include at least 6 animals: a cow, a chicken, a turkey, a kangaroo, a T-Rex and an animal of your choosing (Old McDonald has a weird farm). The cow goes "moo", the chicken goes "cluck", the turkey goes "gobble", the kangaroo goes "g'day mate" and the T-Rex goes "GAAAAARGH". You can have more animals if you like.
Make your code shorter than the song it prints out!
2
u/stereopump 0 0 Apr 23 '12 edited Apr 23 '12
C++
This is my first post to dailyprogrammer, let me know if I messed up at all :P
2
u/Steve132 0 1 Apr 23 '12
Nobody has done 12 days yet, so I did it the naive way in C++.
5
u/magwhich Apr 23 '12
Python, that old mc donald guy sure seems weird
1
u/moomesh Apr 23 '12
C++ Beer: the output is correct. This is my first post here I'd appreciate feedback (+ve and -ve) thanks
3
u/RawketLawnchair Apr 24 '12 edited Apr 24 '12
Java, first time actually doing one of these challenges.
}
Fixed the pluralization of one bottle and not capitalizing the single digit numbers. Also I've been spelling forty wrong my entire life.
2
u/luxgladius 0 0 Apr 23 '12
Perl
Sample Output (not the whole thing):
2
u/V01dK1ng 0 0 Apr 23 '12 edited Apr 23 '12
C++, Old McDonald.Fun challenge btw :D:
Because Reddit was cutting my code I had to rewrite it so it's a bit longer, but oh well works anyway.
2
u/[deleted] Apr 23 '12
lua (my first submission on this subreddit)
2
u/[deleted] Apr 24 '12
PHP w/ HTML : http://www.aj13.net/dp423
1
u/donalmacc 0 0 Apr 23 '12 edited Apr 23 '12
Lua, using only one table
1
u/totallymike Apr 23 '12
C++ Beer:
1
u/[deleted] Apr 24 '12
Javascript: http://jsfiddle.net/dawnerd/zfVkF/
1
u/xxNIRVANAxx 0 0 Apr 24 '12
Java
1
u/Jannisary 0 0 Apr 24 '12 edited Apr 24 '12
So wordy... need to get used to python
https://gist.github.com/2476501
1
u/luxgladius 0 0 Apr 24 '12
Little object-oriented humor for early in the morning. Could have done this shorter, but you see... he "has a" farm! ;)
Sample Output (not all of it)
1
u/mythril225 0 0 Apr 24 '12
Here's mine, done in java. public class challenge42 {
}
1
u/sanitizeyourhands Apr 25 '12 edited Apr 25 '12
12 Days in C# - not the prettiest but I wanted to use a Dictionary since I never have. Any input is appreciated.
1
u/debugmonkey 0 0 Apr 29 '12 edited Apr 30 '12
C++ -- Yep, I used CString. The formatting capabilities are very nice.
1
u/[deleted] May 10 '12
How does it look? This is my first challenge...
}
0
u/[deleted] Apr 23 '12
[deleted] — view deleted comment