June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,42 @@
identification division.
program-id. wr-float.
environment division.
input-output section.
file-control.
select report-file assign "float.txt"
organization sequential.
data division.
file section.
fd report-file
report is floats.
working-storage section.
1 i binary pic 9(4).
1 x-values comp-2.
2 value 1.0.
2 value 2.0.
2 value 3.0.
2 value 1.0e11.
1 redefines x-values comp-2.
2 x occurs 4.
1 comp-2.
2 y occurs 4.
report section.
rd floats.
1 float-line type de.
2 line plus 1.
3 column 1 pic -9.99e+99 source x(i).
2 column 12 pic -9.9999e+99 source y(i).
procedure division.
begin.
open output report-file
initiate floats
perform varying i from 1 by 1
until i > 4
compute y(i) = function sqrt (x(i))
generate float-line
end-perform
terminate floats
close report-file
stop run
.
end program wr-float.

View file

@ -0,0 +1,24 @@
# Project : Write float arrays to a text file
# Date : 2018/02/15
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
decimals(13)
x = [1, 2, 3, 100000000000]
y = [1, 1.4142135623730, 1.7320508075688, 316227.76601683]
str = list(4)
fn = "C:\Ring\calmosoft\output.txt"
fp = fopen(fn,"wb")
for i = 1 to 4
str[i] = string(x[i]) + " | " + string(y[i]) + windowsnl()
fwrite(fp, str[i])
next
fclose(fp)
fp = fopen("C:\Ring\calmosoft\output.txt","r")
r = ""
while isstring(r)
r = fgetc(fp)
if r = char(10) see nl
else see r ok
end
fclose(fp)