Language PL/B
(ANSI Standard PL/B)
| Date: | 11/18/05 |
| Author: | Brian J. Jackson |
| URL: | http://www.adjacency.net |
| Comments: | 1 |
| Info: | http://www.sunbelt-plb.com |
| Score: |
./////////////////////////////////////////////////////////////////////////////.
.// ANSI Standard PL/B version of 99 bottles of beer //.
.// Brian J. Jackson, Adjacency Consulting Group, Inc. (www.adjacency.net)//.
.// 17 NOV 2005 //.
./////////////////////////////////////////////////////////////////////////////.
bottleCount form 2
bottleString dim 8
bottleString2 dim 8
./////////////////////////////////////////////////////////////////////////////.
start
. // set our bottle counter to 99, then begin our descent
move "99" to bottleCount
loop
. // logic to ensure our display is grammatically correct (although
. // I don't know why that would matter after drinking 98 bottles of
. // beer!)
if (bottleCount = 1)
. // 1 bottle of beer left
move " bottle" to bottleString
move " bottles" to bottleString2
elseif (bottleCount = 2)
. // 2 bottles left, then one bottle in the last stanza
move " bottles" to bottleString
move " bottle" to bottleString2
else
. // 3 or more bottles left
move " bottles" to bottleString
move " bottles" to bottleString2
endif
. // display the first three lines of the song
display *ll,bottleCount,bottleString," of beer on the wall...":
*n,bottleCount,bottleString," of beer...":
*n,"take one down, pass it around...";
. // now drink a bottle
subtract "1" from bottleCount
. // and finish the verse
display *n,bottleCount,bottleString2," of beer on the wall.":
*n,*n;
repeat until (bottleCount = 0)
stop
///////////////////////////////////////////////////////////////////////////////
Download Source | Write Comment
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