GLBasic forum

Codesnippets => Code Snippets => Topic started by: MrTAToad on 2009-Jan-24

Title: 99 Bottles of beer
Post by: MrTAToad on 2009-Jan-24
For those old enough to be reading about beer, I hereby announce a program to recite the 99 bottles of beer counting song :

Code (glbasic) Select
LOCAL t$
LOCAL bottles%

FOR bottles=99 TO 1 STEP -1
   t$=isPlural(bottles)

   t$=t$+" of beer on the wall"

   PRINT t$+", "+t$,0,0
   PRINT "Take one down and pass it around, ",0,16

   IF bottles-1>0
      PRINT isPlural(bottles-1)+" of beer on the wall",0,48
   ELSE
      PRINT "No more bottles of beer on the wall",0,32
   ENDIF
   SHOWSCREEN
   KEYWAIT
NEXT

PRINT "No more bottles of beer on the wall, no more bottles of beer.",0,0
PRINT "Go to the store and buy some more, 99 bottles of beer on the wall...",0,16
SHOWSCREEN
KEYWAIT

FUNCTION isPlural:bottles%
LOCAL temp$

   temp$=bottles+" bottle"
   IF bottles>1
      temp$=temp$+"s"
   ENDIF
   RETURN temp$
ENDFUNCTION
Title: Re: 99 Bottles of beer
Post by: Kitty Hello on 2009-Jan-26
You're too late: http://99-bottles-of-beer.net/language-gbasic-277.html (http://99-bottles-of-beer.net/language-gbasic-277.html)
Title: Re: 99 Bottles of beer
Post by: MrTAToad on 2009-Jan-26
Oh, I don't know - there is no GLBasic version - until the above code is accepted, anyway :)