[fpc-pascal] More Filter Madness
Ko Hashiguchi
ko.d.hashiguchi at gmail.com
Fri Oct 14 08:23:51 CEST 2011
Mine is more of a *programming *problem, rather than one native to Pascal,
but here goes:
I have a text file with many Double values. Looking more or less like below,
but with hundreds of entries...
1.5
3.25
7.54
10.33
2.22
The values listed are only for illustration. What I need to do is read the
values in the first file and sum them up such that the output file starts
with the first value, the second entry in the output file is the sum of the
first AND second values, the third entry in the output file is the sum of
the first, second and third values of the input file:
1.5
4.75 (1.5 + 3.25)
12.29 (1.5 + 3.25 + 7.54)
22.62 (1.5 + 3.25 + 7.54 + 10.33)
24.84 (1.5 + 3.25 + 7.54 + 10.33 + 2.22)
The process of summing up continues to the end of the file.
I figure this is a program loop problem, rather than a Pascal problem, but
it's beyond me. I would greatly appreciate assistance.
Thank you,
Ko Hashiguchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111013/63a949e9/attachment.html>
More information about the fpc-pascal
mailing list