September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
42
Task/Odd-word-problem/BaCon/odd-word-problem.bacon
Normal file
42
Task/Odd-word-problem/BaCon/odd-word-problem.bacon
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
OPEN "/dev/stdin" FOR DEVICE AS in
|
||||
|
||||
FUNCTION get_odd()
|
||||
|
||||
LOCAL ch, letter
|
||||
|
||||
ch = MEMORY(1)
|
||||
GETBYTE ch FROM in
|
||||
|
||||
IF NOT(REGEX(CHR$(PEEK(ch)), "[[:punct:]]")) THEN
|
||||
letter = get_odd()
|
||||
PRINT CHR$(PEEK(ch));
|
||||
ELSE
|
||||
letter = PEEK(ch)
|
||||
END IF
|
||||
|
||||
FREE ch
|
||||
RETURN letter
|
||||
|
||||
END FUNCTION
|
||||
|
||||
mem = MEMORY(1)
|
||||
PRINT "Enter string: ";
|
||||
|
||||
WHILE TRUE
|
||||
|
||||
GETBYTE mem FROM in
|
||||
PRINT CHR$(PEEK(mem));
|
||||
|
||||
IF REGEX(CHR$(PEEK(mem)), "[[:punct:]]") THEN
|
||||
IF PEEK(mem) <> 46 THEN
|
||||
POKE mem, get_odd()
|
||||
PRINT CHR$(PEEK(mem));
|
||||
END IF
|
||||
IF PEEK(mem) = 46 THEN BREAK
|
||||
END IF
|
||||
WEND
|
||||
|
||||
FREE mem
|
||||
CLOSE DEVICE in
|
||||
|
||||
PRINT
|
||||
Loading…
Add table
Add a link
Reference in a new issue