WORKSHOP\XMAS.BAS  ·  BAS  ·  1.2 KB  ·  1991-01-01  ·  from PCPlus_Issue-52_Jan-1991_FluxEngine-360Kb
DECLARE SUB Gifts (x)
DECLARE FUNCTION Ordinal$ (x)
FOR Verse = 1 TO 12
  CLS
  PRINT "On the"; Ordinal$(Verse); " day of Christmas"
  PRINT "My true love sent to me . . ."
  Gifts Verse
  WHILE INKEY$ = "": WEND
  NEXT
END

SUB Gifts (x)
  SELECT CASE (x)
    CASE 1
      PRINT " a partridge in a pear tree."
    CASE 2
      PRINT "  two turtle doves"
      PRINT "and"
    CASE 3
      PRINT "  three French hens,"
    CASE 4
      PRINT "  four calling birds,"
    CASE 5
      PRINT "  five gold rings,"
    CASE 6
      PRINT "  six geese a-laying,"
    CASE 7
      PRINT "  seven swans a-swimming,"
    CASE 8
      PRINT "  eight maids a-milking,"
    CASE 9
      PRINT "  nine ladies dancing,"
    CASE 10
      PRINT "  ten lords a-leaping,"
    CASE 11
      PRINT "  eleven pipers piping,"
    CASE 12
      PRINT "  twelve drummers drumming,"
    CASE ELSE
      PRINT
      EXIT SUB
  END SELECT
  Gifts x - 1
END SUB

FUNCTION Ordinal$ (x)
  SELECT CASE (x)
    CASE 1
      temp$ = "st"
    CASE 2
      temp$ = "nd"
    CASE 3
      temp$ = "rd"
    CASE ELSE
      temp$ = "th"
  END SELECT
  Ordinal$ = STR$(x) + temp$
END FUNCTION