99 Bottles of beer

Previous topic - Next topic

MrTAToad

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

Kitty Hello


MrTAToad

Oh, I don't know - there is no GLBasic version - until the above code is accepted, anyway :)