>> Good candidate for recursive algorithm i think.
 > At first glance maybe, but it is actually a horrible candidate.

IMHO, this is far from being a problem that needs to be solved with recursion. Indeed, you don't need recursion at all: you have a file, and just need to sum its values till EOF; only you need also to show the partial result at each step. Moreover, since the file has a well known beginning and end, a cycle is more than enough. Recursion is for other things, such as expression parsing etc. where you don't (and neither possibly can't) actually know how deep may the nesting.


Just my 2c

Cheers, A.

--
Alberto Narduzzi
ANSware Ltd.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to