Language Delphi
(Recursive version)
Date: | 01/12/06 |
Author: | Juan Carlos Molinos |
URL: | n/a |
Comments: | 2 |
Info: | n/a |
Score: | (2.97 in 35 votes) |
program bot99; {$APPTYPE CONSOLE} uses SysUtils; procedure Sing(bot:integer); begin Writeln(''); case bot of 0: begin Writeln('No more bottles of beer on the wall, no more bottles of beer.'); Writeln('Go to the store and buy some more, ' +'99 bottles of beer on the wall.'); end; 1: begin Writeln('1 bottle of beer on the wall, 1 bottle of beer.'); Writeln('Take one down and pass it around, ' +'no more bottles of beer on the wall.'); Sing(bot-1); end; else begin Writeln(inttostr(bot)+' bottles of beer on the wall, ' +inttostr(bot)+' bottles of beer.'); Writeln('Take one down and pass it around, '+inttostr(bot-1) +' bottle of beer on the wall.'); Sing(bot-1); end; end; end; begin Sing(99); end.
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
OO version - Delphi 7 | Luis Carlos F. Dias | 09/10/05 | 9 | |
standard version | Anonymous | 04/20/05 | 4 | |
OO Simple version (not using Interfaces) | Luis Carlos F. Dias | 09/04/05 | 0 | |
NonVCL version | Philipp Winterberg | 04/20/05 | 0 | |
OO version (with interface) | Luis Carlos F. Dias | 09/05/05 | 0 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
Phil Rogers said on 09/15/06 16:17:17
For the case of 1 bottle, the code should be
Writeln('Take it down and pass it around, '
and not
Writeln('Take one down and pass it around, '
Homolibere said on 03/14/08 16:51:58
TOP GEEK! I Like That Small Source Code.