Identification Division.
Program-Id. Victor.
* Buch "Introduction to Cybernetics", 1966
* von Viktor Gluschkow
* p272
Data Division.
Working-Storage Section.
78 n value 100.
77 p pic 9(4).
77 i pic 9(4).
77 j pic 9(4).
77 k pic 9(4).
77 s pic 9(4).
77 xf pic 9(4).
77 xs pic 9(4).
77 vs pic 9(4).
77 vf pic 9(4).
77 yf pic 9(4).
77 ys pic 9(4).
77 sf pic 9(4)V99.
77 ss pic 9(4)V99.
77 a pic 9.
77 r pic 9 occurs n.
Procedure Division.
* Formula
L.
accept r
move 0 to sf ss
move 0 to s
perform varying i from 1 until i=n
if r(xf(i)) and not r(yf(i)) then
add vf(i) to sf
end-if
if r(xs(i)) and not r(ys(i)) then
add vf(i) to sf
end-if
end-perform
if sf>ss move 1 to p.
if sf<ss move 2 to p.
if sf=ss goto L.
display p
accept a
if a and (p=1) then
perform varying j from 1 until j=n
if r(xf(j)) and not r(yf(j)) then
add 1 to vf(j)
end-perform
if a and (p=2) then
perform varying k from 1 until k=n
if r(xs(k)) and not r(ys(k)) then
add 1 to vs(k)
end-perform
goto L.
* P=???
End-Program Victor.
¤ Dauer der Verarbeitung: 0.2 Sekunden
¤
*© Formatika GbR, Deutschland