Anonymous user
Odd word problem: Difference between revisions
m
→{{header|REXX}}: simplified the program, changed some comments.
m (→{{header|REXX}}: split compound statements, used a template for the output section, simplified the code.) |
m (→{{header|REXX}}: simplified the program, changed some comments.) |
||
Line 2,281:
do until x==. /* [↓] perform until reaching a period*/
do until \datatype(x, 'M') /* [↓] " " punctuation found*/
call
call
end /*until \data···*/ /* [↑] read/write until punctuation. */
if x==. then leave /*is this the end─of─sentence (period)?*/
call readLetters; punct= # /*save the location of the punctuation.*/
do j=#-1 by -1 /*read some characters backwards. */
call
if \datatype(x, 'M') then leave /*Found punctuation? Then leave J. */
call
end /*j*/ /* [↑] perform for "even" words. */
call
call
end /*until x==.*/
end /*case*/ /* [↑] process both of the input files*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
{{out|output|text= when using the two (default) input files which contain:}}
:* input file '''ODDWORD.IN1''' ───► <tt> what,is,the;meaning,of:life. </tt>
|