Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!haven!uvaarpa!virginia!scl From: scl@virginia.acc.virginia.edu (Steve Losen) Newsgroups: comp.lang.pascal Subject: Re: file windows (was Re: Standard Pascal) Message-ID: <2977@virginia.acc.virginia.edu> Date: 31 Jul 89 16:44:15 GMT References: <2929@virginia.acc.virginia.edu> <1.filbo@gorn.santa-cruz.ca.us> Reply-To: scl@virginia.acc.Virginia.EDU (Steve Losen) Organization: University of Va., Charlottesville, VA Lines: 42 Sorry folks. The example I posted earlier was incomplete and has caused quite a bit of confusion. Here is a complete Pascal program. It looks for integers in a file and sums them. It doesn't care how many integers are are on a line nor what separates them. program sum(input, output); var number, total : integer; begin total := 0; while not eof do begin if (input^ >= '0') and (input^ <= '9') then begin read(number); total := total + number; end else get(input); end; writeln(total); end. Here is the sample input: ,,100 ,20, , 30 40,, 5050 ,,, The only point that I was trying to make was that Standard Pascal handles this particular problem very nicely. It certainly doesn't do everything, however. Furthermore, if a Pascal compiler either fails to compile this or fails to print 5240 with the above input, then that compiler does not conform to the ISO Standard. Again, I apologize for any confusion that I have caused. -- Steve Losen scl@virginia.edu University of Virginia Academic Computing Center