September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
33
Task/Odd-word-problem/Phix/odd-word-problem.phix
Normal file
33
Task/Odd-word-problem/Phix/odd-word-problem.phix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
string s = "what,is,the;meaning,of:life."
|
||||
--string s = "we,are;not,in,kansas;any,more."
|
||||
integer i = 0
|
||||
|
||||
function getchar()
|
||||
i += 1
|
||||
return s[i]
|
||||
end function
|
||||
|
||||
function wrod(integer rev)
|
||||
integer ch = getchar(), nch
|
||||
-- integer ch = getc(0), nch
|
||||
if not find(ch," .,:;!?") then
|
||||
if rev then
|
||||
nch = wrod(rev)
|
||||
end if
|
||||
puts(1,ch)
|
||||
if not rev then
|
||||
nch = wrod(rev)
|
||||
end if
|
||||
ch = nch
|
||||
end if
|
||||
return ch
|
||||
end function
|
||||
|
||||
--puts(1,"Enter words separated by a single punctuation mark (i.e. !?,.;:) and ending with .\n")
|
||||
integer rev = 0
|
||||
while 1 do
|
||||
integer ch = wrod(rev)
|
||||
puts(1,ch)
|
||||
if ch='.' then exit end if
|
||||
rev = 1-rev
|
||||
end while
|
||||
Loading…
Add table
Add a link
Reference in a new issue