identification division.
program-id. substitute.
* aus Wirth, systematisches Programmieren p. 110
author. "JD".
date-written. 11.9.2005.
date-compiled.
data division.
working-storage section.
78 bd pic 9(4) value 100.
77 i pic 9(4).
77 j pic 9(4).
77 k pic 9(4).
77 m pic 9(4).
77 n pic 9(4).
77 d pic 9(4).
77 P pic 9(4).
77 q.
88 true-v value 1.
88 false-v value 0.
linkage section.
77 x pic 9(4)V9(4) occurs bd.
77 z pic 9(4)V9(4) occurs bd.
77 r pic 9(4).
77 temp1 pic 9(4).
procedure division using z r.
* substitutes x in row z
move i to p
perform until q or (i=p)
move 1 to j
perform until not q or (j>k)
compute temp1 = i + j - 1
if x(j) = z(temp1) then set true-v to true
else set false-v to true end-if
add 1 to j
end-perform
add 1 to i
if i > n then move 1 to i end-if
end-perform
if q then
subtract k from m giving d
move i to p
if d < 0 then
add p k giving j
perform until j > n
compute temp1 = j + d
move z(j) to z(temp1)
add 1 to j
end-perform
else
if d > 0 then
move n to j
perform until j < p + k
compute temp1 = j + d
move z(j) to z(temp1)
add 1 to j
end-perform
add d to n
move 1 to j
perform until j > m
move z(j) to z(p)
add 1 to p
add 1 to j
end-perform
end-if.
end-program substitute.
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|