[fpc-pascal] More Filter Madness
vincent.snijders at gmail.com
Fri Oct 14 08:49:36 CEST 2011
2011/10/14 Ko Hashiguchi <ko.d.hashiguchi at gmail.com>:
> 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...
> 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:
sum := 0;
while not eof(infile) do begin
sum := sum + value'
Depending on how many numbers you read and the difference between
magnitude of sum and value, you may have to do some extra work for the
numeric stability. but that is for later concern.
More information about the fpc-pascal