' D++ version of 99 Bottles of beer (Bottles.dpp)
' See http://squeakmac.tripod.com/dppdownloads.html
' Philipp Winterberg, http://www.winterbergs.de
title "99 Bottles of Beer";
newvar b = 99;
do until b = 0;
screenput b & " bottle(s) of beer on the wall,"; screen;
screenput b & " bottle(s) of beer."; screen;
screenput "Take one down, pass it around,"; screen;
b--;
screenput b & " bottle(s) of beer on the wall."; screen; screen;
doevents;
loop
// D version of 99 Bottles of beer (Bottles.d)
// (http://www.digitalmars.com/d/index.html).
// Philipp Winterberg, http://www.winterbergs.de
int main()
{
for (int b = 99; b > 0; b--)
{
printf("%d bottle(s) of beer on the wall,\n", b);
printf("%d bottle(s) of beer.\n", b);
printf("Take one down, pass it around,\n");
printf("%d bottle(s) of beer on the wall.\n\n", (b-1));
}
return 0;
}
Apple's Data Access Language
/*
DAL version of 99 Bottles of beer programmer:
by Georg Hentsch: ghentsch@blsoft.com
*/
declare integer beers = 99;
declare varchar s;
while (beers > 0)
{
if (beers != 1)
s = "s";
else
s = "";
printf("%d bottle%s of beer on the wall,\n", beers, s);
printf("%d bottle%s of beeeeer . . . ,\n", beers, s);
printf("Take one down, pass it around,\n");
beers--;
if (beers > 0)
printf("%d", beers);
else
printf("No more");
if (beers != 1)
s = "s";
else
s = "";
printf(" bottle%s of beer on the wall.\n", s);
}
rem DarkBasic version of 99 Bottles of beer (Bottles.dba)
rem http://www.darkbasic.com/download.php
rem Philipp Winterberg, http://www.winterbergs.de
a$=" bottle(s) of beer" : c$=" on the wall"
for b=99 to 1 step -1
print b, a$, c$, ","
print b, a$, "."
print "Take one down, pass it around,"
print b-1, a$, c$, "."
wait (1000) : cls rgb(0,0,0)
next b : end
Some biochemists write code in a programming language called Darwin, which
is an interpreted language with support for many of the functions used
when analyzing biological sequences. Here is '99 bottles of beer' in
Darwin. It even handles plural.
plural := proc(num)
if num = 1 then
return(''):
else
return('s'):
fi:
end:
bottlesong := proc()
for i from 99 to 1 by -1 do
printf('%d bottle%s of beer on the wall. \n', i, plural(i)):
printf('%d bottle%s of beer\n', i, plural(i)):
printf('Take one down, pass it around.\n'):
printf('%d bottle%s of beer on the wall.\n\n', i-1, plural(i-1)):
od:
end:
bottlesong();
/*
// beer.src
// Dataflex 2.3
// R. Wingerter, rwingerter@t-online.de
//
clearscreen
number i
move 99 to i
repeat
showln i " bottle(s) of beer standing on the wall"
showln "Take one down, pass it around"
showln ""
move (i-1) to i
until i EQ 0
showln i " bottle(s) of beer standing on the wall
showln "Gotta go to the store and buy some more"
abort
private s
for i = 1 to 99
s = 100 - i
? ltrim(str(s)) + " Bottle" + iif(s > 1,"s","") + " of beer on the wall " + ;
ltrim(str(s)) + " bottle" + iif(s> 1,"s","") + " of beer"
? " Take one down and pass it around"
? iif(s - 1 = 0,"No more",ltrim(str(s - 1))) + " Bottle" + iif(s = 2,"","s") + ;
" of beer on the wall"
endfor
? "No more bottles of beer on the wall, No more bottles of beer"
? "Go to the store and buy some more - 99 bottles of beer on the wall"
//
// Generated on 10/11/2002
//
parameter bModal
local f
f = new _9Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class _9Form of FORM
with (this)
onClose = {;form.Release()}
height = 22.1818
left = -0.1429
top = -0.0455
width = 109.8571
text = "99 Bottles of Beer"
endwith
this.EDITOR1 = new EDITOR(this)
with (this.EDITOR1)
height = 20
left = 2
top = 0.5
width = 107
value = ""
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 1.5
left = 1
top = 20.5
width = 107
text = "Start"
borderStyle = 7 // Client
endwith
function PUSHBUTTON1_onClick
form.Editor1.Value = ""
form.suffix = "s "
for i = 99 to 1 step -1
if i = 1
form.suffix = " "
endif
form.num = transform(i,"999") + " "
form.num2 = transform(i - 1,"999") + " "
form.Editor1.Value = form.Editor1.Value + form.num + "bottle" +;
form.suffix + "of beer on the wall, " +;
form.num + "bottle" + form.suffix +;
"of beer. Take one down and pass it around, "+;
iif(i > 1,form.num2 + "bottle" + iif(i > 2,form.suffix," "),"No more bottles ") + ;
"of beer on the wall." +;
chr(13)
next
form.Editor1.Value = form.Editor1.Value + " No more bottles of beer on the wall, " + chr(13) + ;
" no more bottles of beer. " + chr(13) +;
" Go to the store and get some more." + chr(13) +;
" 99 bottles of beer on the wall"
return
endclass
&& BEER.PRG - 99 Bottles of Beer - Brian Hobbs Jan 1996
&& (BHOBBS@cayman.vf.mmc.com)
SET TALK OFF
I=99
DO WHILE I>=1
b = STR(i,2)
? b +" Bottle"
IF i > 1
?? "s"
ENDIF
?? " of beer on the wall "+b+" bottle"
IF i> 1
?? "s"
ENDIF
?? " of beer"
? " Take one down and pass it around"
i=i-1
b = STR(i,2)
if i = 0
b = "No more"
ENDIF
? b + " Bottle"
IF I > 1 .OR. I=0
?? "s"
ENDIF
?? " of beer on the wall"
?
ENDDO
? "No more bottles of beer on the wall, No more bottles of beer"
? "Go to the store and buy some more - 99 bottles of beer on the wall"
SET TALK ON
dc is the Desk Calculator for *nix; It works on reverse polish
notation, and a few other commands. The output of this routine
is a little jagged, as dc has no commands to control screen formatting.
Usage: dc 99bottles
where this source file is saved as 99bottles
NB: A blank line is required at the end of the file
Without it, dc will not quit.
<PRE>
[ bottles of beer on the wall
]sa
[ bottles of beer
]sb
[ take one down, pass it around
]sc
[
]sd
99sn
[lalnpsnPlblnp1-snPlcPlalnpsnPldPln0<x]sx
lxx
q
$! 99 bottles of beer
$! Written for VMS DCL by rsteenw@xs4all.nl
$!
$! $fao is a system lexical function, where FAO stands for
$! Formatted ASCII Output. There's a fair bunch of these
$! functions accessible via DCL (the command interpreter),
$! like querying system, device, process and user parameters,
$! string and list manipulation, file system foo, and more.
$!
$ cnt = 99
$ msg = f$fao("!UB bottle!1%C!%Es!%F of beer", cnt)
$ loop:
$ write sys$output f$fao("!AS on the wall!/!-!AS", msg)
$ write sys$output "Take one down and pass it around"
$ cnt = cnt - 1
$ if cnt .gt. 0
$ then
$ msg = f$fao("!UB bottle!1%C!%Es!%F of beer", cnt)
$ write sys$output f$fao("!AS on the wall!/", msg)
$ goto loop
$ else
$ write sys$output "No more bottles of beer on the wall"
$ endif
$ I=100
$ FIRSTLOOP:
$ IF (I.EQ. 1) THEN GOTO LAST_BOTTLE
$ WRITE SYS$OUTPUT I," BOTTLES OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT I," BOTTLES OF BEER"
$ WRITE SYS$OUTPUT "IF ONE OF THEM SHOULD HAPPEN TO FALL"
$ WRITE SYS$OUTPUT I-1," BOTTLE OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT " "
$ I=I-1
$ GOTO FIRSTLOOP
$ LAST_BOTTLE:
$ WRITE SYS$OUTPUT "1 BOTTLE OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT "1 BOTTLE OF BEER"
$ WRITE SYS$OUTPUT "IF IT SHOULD HAPPEN TO FALL"
$ WRITE SYS$OUTPUT "NO MORE BOTTLES OF BEER ON THE WALL"
// *short* Delphi version of 99 Bottles of beer (Bottles.dpr)
// Philipp Winterberg, http://www.winterbergs.de
program Bottles;
uses windows, sysutils;
var b: integer;
begin
for b:= 99 downto 1 do
if MessageBox(0, Pchar(IntToStr(b) + ' bottle(s) of beer on the wall, ' + #13#10 +
IntToStr(b) + ' bottle(s) of beer.' + #13#10#13#10 +
'Take one down, pass it around,' + #13#10 +
IntToStr(b-1) + ' bottle(s) of beer on the wall.' + #13#10),
PChar('99 Bottles of Beer'), 65) = 2
then exit
end.
program BeerSong;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
b :integer;
begin
WriteLn( Format('%d bottles of beer on the wall', [99]));
WriteLn( Format('%d bottles of beer', [99]));
WriteLn( 'You take one down and pass it around');
for b := 98 downto 2 do
begin
WriteLn( Format('%d bottles of beer on the wall.', [b]));
WriteLn('');
WriteLn( Format('%d bottles of beer on the wall', [b]));
WriteLn( Format('%d bottles of beer', [b]));
WriteLn( 'You take one down and pass it around');
end;
b := 1;
WriteLn( Format('%d bottle of beer on the wall', [b]));
WriteLn('');
WriteLn( Format('%d bottle of beer', [b]));
WriteLn( 'You take one down and pass it around');
WriteLn( 'No bottles of beer on the wall!');
end
# Dialect version of 99 Bottles of beer (Bottles.d)
# See http://www.aristar.com/Downloads2.html
# Philipp Winterberg, http://www.winterbergs.de
Import "outputs"
Output = outputs.screen()
Output.startDoc("99 Bottles of Beer")
for b = 1 to 99
print (100-b), " bottle(s) of beer on the wall,", cr
print (100-b), " bottle(s) of beer.", cr
print "Take one down, pass it around,", cr
print (99-b), " bottle(s) of beer on the wall.", cr, cr
endfor
Output.EndDoc()
.TITLE - "Program to display 99 bottles of beer on the wall"
;
;=======================================================================================================
; Author: Bob Welton (welton@pui.com)
; Projects Unlimited Inc.
; Dayton, OH 45414
;
; Language: DIBOL or DBL
;=======================================================================================================
RECORD MISC
NUMBOTTLES ,D2,99 ;Default # of bottles to 99
ANUMBOTTLES ,A2 ;Used to mask the output of bottles
.PROC
XCALL FLAGS (0007000000,1) ;Suppress STOP message
OPEN (8,O:C,"TT:") ;Open the terminal/display
REPEAT
BEGIN
ANUMBOTTLES = NUMBOTTLES,'ZX'
WRITES (8,ANUMBOTTLES+" Bottles of Beer on the wall,")
ANUMBOTTLES = NUMBOTTLES,'ZX'
WRITES (8,ANUMBOTTLES+" Bottles of Beer,")
WRITES (8," Take one down, pass it around,")
DECR NUMBOTTLES ;Reduce # of bottles by 1
IF (NUMBOTTLES .LE. 1) EXITLOOP ;If just 1 bottle left, get out
ANUMBOTTLES = NUMBOTTLES,'ZX'
WRITES(8,ANUMBOTTLES+" Bottles of Beer on the wall.")
WRITES (8," ")
END
ANUMBOTTLES = NUMBOTTLES,'ZX'
WRITES(8,ANUMBOTTLES+" Bottle of Beer on the wall.")
WRITES (8," ")
WRITES (8,ANUMBOTTLES+" Bottle of Beer on the wall,")
WRITES (8,ANUMBOTTLES+" Bottle of Beer,")
WRITES (8," Take one down, pass it around,")
WRITES (8," ")
WRITES (8," ")
WRITES (8, "Hey the Beer's gone, I am out of here...")
SLEEP 2
CLOSE 8
STOP
.END
// DiNGS Game Basic version of 99 Bottles of beer (Bottles.src)
// See http://www.dream-d-sign.de/DINGS/Infos/infos.html
// Philipp Winterberg, http://www.winterbergs.de
LIMITFPS 23; BLACKSCREEN
FOR b=99 TO 1 STEP -1
PRINT b, 23, 23; PRINT " bottle(s) of beer on the wall,", 23, 23
PRINT b, 23, 63; PRINT " bottle(s) of beer.", 23, 63
PRINT "Take one down, pass it around,", 23, 103
PRINT b-1, 23, 143; PRINT " bottle(s) of beer on the wall.", 23, 143
SHOWSCREEN; MOUSEWAIT
NEXT; END
**********************************************************************
*
* 99 Bottles of Beer on the wall
*
* Uses Group 1 Software PCE (Post Composition Engine) Language
* www.g1.com
*
* By: Donavan Hoepcke www.computerdudes.nu
*
**********************************************************************
declare <done>;
declare <num-bottles>;
declare <num-bottle-str>;
declare <zero>;
declare <one>;
// Procedures
declare procedure <main> is main;
**********************************************************************
begin procedure <main>;
let <zero> = 0;
let <one> = 1;
let <done> = false;
let <num-bottles> = 99;
let <num-bottle-str> = string <num-bottles> 0 zero;
begin loop;
trace "@@<num-bottle-str> bottles of beer on the wall";
trace "@@<num-bottle-str> bottles of beer";
trace "Take one down, pass it around";
let <num-bottles> = <num-bottles> - <one>;
let <num-bottle-str> = string <num-bottles> 0 zero;
let <done> = <num-bottles> eq <one>;
exit loop when <done>;
trace "@@<num-bottle-str> bottles of beer on the wall";
end loop;
trace "@@<num-bottle-str> bottle of beer on the wall";
trace "@@<num-bottle-str> bottle of beer";
trace "Take one down, pass it around";
trace "Time to buy some more beer for the wall";
end procedure; // <main>
@echo off
REM 99 Bottles of Beer in DOS Batch
REM Gert-jan Los (los@lsdb.bwl.uni-mannheim.de)
REM The file with batch program must be named as "beer.bat"
REM Noted by Vladimir Vojacek (vojacek@seznam.cz), 2003-07-03
if "%1"=="" goto outer
if "%1"=="body" goto body
:inner
for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer body %2 %%a
goto exit
:outer
for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer inner %%a
goto exit
:body
set num=%2%3
set bottle=bottles
if "%num%"=="99" goto skipfirst
if "%2"=="0" set num=%3
if "%num%"=="1" set bottle=bottle
echo %num% %bottle% of beer on the wall
echo.
if "%num%"=="0" exit
:skipfirst
echo %num% %bottle% of beer on the wall
echo %num% %bottle% of beer
echo take one down and pass it around
:exit
Dot-Tool is a self-written development-tool from Christopher
Winter, employee of Siemens VDO Automotive AG, and is used
within the software development and simulation of the multi-
function-displays of Siemens VDO.
@99Bottles
// 99 bottles of beer with DOT-Tool Macro
// DOT-Tool - dot-display-simulation
// (c) Christopher Winter
// set display dimensions
MODE("FREI", 193, 36);
// show dot
PAGE(3);
// switch on dot-grid
GRID(1);
ANIMATE(0);
// drink!
FOR (i=99; i > 0; i--) {
CLS();
TEXT(1, 1,2,itoa(i)+" BOTTLES OF BEER ON THE WALL,");
TEXT(1,10,2,itoa(i)+" BOTTLES OF BEER");
TEXT(1,19,2,"TAKE ONE DOWN AND PASS IT AROUND");
TEXT(1,28,2,itoa(i-1)+" BOTTLES OF BEER ON THE WALL");
UPDATE();
ANIMATE(2);
PAUSE(100);
ANIMATE(1);
}
ANIMATE(3, "99BOTTLES.GIF");
{ DPas version of 99 Bottles of beer (Bottles.pas) }
{ See (http://www.geocities.com/SiliconValley/Bay/9159/dpas.html }
{ Philipp Winterberg, http://www.winterbergs.de }
program Bottles;
uses crt32;
var b: byte = 99;
begin
while b > 0 do
begin
writeln(b, ' bottle(s) of beer on the wall, ');
writeln(b, ' bottle(s) of beer.');
writeln('Take one down, pass it around,'); dec(b);
writeln(b, ' bottle(s) of beer on the wall.');
writeln(' ');
end;
end.
An Amiga language combining features of <a href=#c>C</a> and <a href=#pascal>Pascal</a>
/* 99 Bottles of Beer */
/* James Hicks (hicksjl@cs.rose-hulman.edu) */
/* 5 August 1996 */
int BEERS = 99;
proc main()void:
uint i;
for i from BEERS downto 1 do
if i > 1 then
writeln(i, " bottles of beer on the wall, ", i, " bottles of beer.");
else
writeln(i, " bottle of beer on the wall, ", i, " bottle of beer.");
fi;
writeln("Take one down, pass it around,");
if i > 2 then
writeln(i - 1, " bottles of beer on the wall.");
elsif i > 1 then
writeln(i - 1, " bottle of beer on the wall.");
else
writeln("No bottles of beer on the wall.");
fi;
od;
corp;
For Info see <a href=http://www.dssp.msk.ru>http://www.dssp.msk.ru</a>
[ 99 bottles in DSSP
Programmer: Laszlo Aszalos <aszalos@math.klte.hu>
Run it with 99 BOTTLE
]
B10
: BOTTLE [N] LOT_OF ONE_LEFT ZERO [] ;
: LOT_OF [N] CR C 1- DO ONE_BOTTLE D ;
: ONE_BOTTLE [N]
ON_THE_WALL .", " CR NUMBER_OFF BOTTLES ."," CR
TAKE 1- [N-1] C 1 = IF0 MANY ;
: MANY ON_THE_WALL ."." CR ;
: TAKE ."take one down, pass it around," CR ;
: ON_THE_WALL NUMBER_OFF BOTTLES ." on the wall" ;
: BOTTLES ." bottles of beer" ;
: ONE_LEFT ONE_ON_THE_WALL ."." CR ONE_ON_THE_WALL ."," CR BOTTLE1
."," CR ;
: ONE_ON_THE_WALL BOTTLE1 ." on the wall" ;
: BOTTLE1 ." 1 bottle of beer" ;
: ZERO TAKE ZERO_ON ."." CR ZERO_ON ."," CR NO_MORE ."," CR
."go to the store, and buy some more!" CR ;
: ZERO_ON NO_MORE ." on the wall" ;
: NO_MORE ."no more bottles of beer" ;
: NUMBER_OFF C 2 TON ;
: NUMBER_OFF C 2 TON ;
DTML (Document Template Markus Language) is the scripting language
of the web management tool 'Zope'.
<dtml-call "REQUEST.set('i',_.range(0,100,1))">
<dtml-call "REQUEST.set('r',99)">
<dtml-in i reverse>
<dtml-if expr="r==1">
<dtml-var sequence-item> bottle of beer on the wall, <dtml-var
sequence-item> bottle of beer
take one down, pass it around,
<dtml-var sequence-item> bottle of beer.
<dtml-elif expr="r==0">
no more bottles of beer on the wall.
Go to the store, buy some more.
<dtml-else>
<dtml-var sequence-item> bottles of beer on the wall, <dtml-var
sequence-item> bottles of beer
take one down, pass it around,
<dtml-var sequence-item> bottles of beer.
</dtml-if>
<dtml-call "REQUEST.set('r',r-1)">
</dtml-in>
Here's one more example to add to the list. It is in a language called
'DYL-280' (pronounced 'dial 280').
FILE INFILE INPUT FB
WORKAREA
NUMOFBOTTLES 3 NU
REPORT 80 WIDE
NUMOFBOTTLES = 99
LOOP:
IF NUMOFBOTTLES EQ 0
LIST 'NO MORE BEER ON THE WALL.'
STOP
ENDIF
LIST NUMOFBOTTLES () 'BOTTLES OF BEER ON THE WALL,' AT NUMOFBOTTLES+4
LIST NUMOFBOTTLES () 'BOTTLES OF BEER.' AT NUMOFBOTTLES+4
LIST 'TAKE ONE DOWN PASS IT AROUND' AT NUMOFBOTTLES+4
NUMOFBOTTLES = NUMOFBOTTLES - 1
LIST NUMOFBOTTLES () 'BOTTLES OF BEER ON THE WALL.' AT NUMOFBOTTLES+4
LIST ' '
GOTO LOOP
FIN
/*
// Dylan version of 99 Bottles of Beer
// programmer: Jim Studt jim@federated.com
define method enumerate( count == 1 ) "1 bottle" end method enumerate;
define method enumerate( count == 0 ) "no more bottles" end method enumerate;
define method enumerate( count :: <integer> )
format-to-string("%d bottles", count);
end method enumerate;
define method reference( count == 1) "it" end method reference;
define method reference( count :: <integer>) "one" end method reference;
define method main (argv0, #rest noise)
for ( i from 99 to 1 by -1)
format( *standard-output*, "%s of beer on the wall, %s of beer.\n",
enumerate(i), enumerate(i));
format( *standard-output*,
" Take %s down, pass it around, %s of beer on the wall.\n",
reference(i), enumerate( i - 1));
end for;
end method main;