identification division.
program-id. fileavg.
* aus Wirth, systematisches Programmieren p. 73
author. "JD".
date-written. 25.10.2004.
date-compiled.
environment division.
input-output section.
file-control.
select f assign to file-f
status f-status.
data division.
file section.
fd f
record contains 120 characters
data record is f-record
label record is omitted.
01 f-record.
05 i pic x(8).
working-storage section.
77 m pic 9(4).
77 n pic 9(4).
77 s pic 9(4).
77 f-status pic S9(4) comp.
procedure division.
* computes x / y
move 0 to m n.
open input f
perform until f-status <= 0
read f into f-record
add 1 to n
add i to m
end-perform.
close f
divide n into m
move 0 to s
open input f
perform until f-status <= 0
read f into f-record
add 1 to n
add i to m
end-perform.
compute s = function sqrt(n)
* sqrt(a/n) ???
display "s=" s.
end-program fileavg.
¤ Dauer der Verarbeitung: 0.14 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.
|