September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

28
Task/Nth/BaCon/nth.bacon Normal file
View file

@ -0,0 +1,28 @@
' Nth (sans apostrophes)
FUNCTION nth$(NUMBER n) TYPE STRING
LOCAL suffix
IF n < 0 THEN RETURN STR$(n)
IF MOD(n, 100) >= 11 AND MOD(n, 100) <= 13 THEN
suffix = "th"
ELSE
suffix = MID$("thstndrdthththththth", MOD(n, 10) * 2 + 1, 2)
ENDIF
RETURN CONCAT$(STR$(n), suffix)
END FUNCTION
' Test a few ranges
FOR i = 1 TO 4
READ first, last
per = 1
FOR n = first TO last
PRINT nth$(n) FORMAT "%s "
' limit to 10 entries per line
IF per = 10 OR n = last THEN
per = 1
PRINT
ELSE
INCR per
ENDIF
NEXT
NEXT
DATA 0, 25, 250, 265, 1000, 1025, -20, -11