Article View: comp.lang.modula2
Article #2982Re: Arrays of Records and Sequential File Reading
From: Dieter Wienrich
Date: Tue, 31 Oct 1995 08:57
Date: Tue, 31 Oct 1995 08:57
34 lines
1978 bytes
1978 bytes
> Str.Match(); I did not realize that Str.Match is a boolean function. After fixing
> that bug I have moderate success with the program. However, when I search the library,
> I am using a REPEAT/UNTIL loop with my IF Str.Match(title,singlebook[x].TITLE) THEN
> in between. If a match is found then I print out the Title of the specific book, If the
> title is not found in the library, then I print out that the title is not found, but during
> the search of the library until my 'x' := maxbook, I end up printing out 'book not found' until
> I find a match. I thought of changing the REPEAT loop to a FOR...NEXT loop, similar to what
To be sure what your problem is:
When running your program you enter a title and receive a lot of
"book not found" (until you get "found" or "end of list")?
If this is not the problem, forget the rest and specify again.
1. you decide how to search:
the whole library (if there are serveral matches possible)
FOR x := 1 to max.. DO ...
only until the first match.
REPEAT ... UNTIL isFound
2. you do your search,
but instead of output "not found" you set a boolean isFound
in your search loop,
3. you evaluate isFound after the whole search.
if you set isFound := FALSE before your search, you must only set it
TRUE when there is a match.
hope this helps
Dieter Wienrich
Technical Details
Message-ID:
<474odt$npe@p235.informatik.uni-Bremen.de>Path:
arc1-ca.pugleaf.net!informatik.uni-bremen.de!newsReferences:
<46ngu2$r72@grid.Direct.CA> <DH2EpC.MIo@cix.compulink.co.uk> <472lcc$kdk@grid.Direct.CA>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!informatik.uni-bremen.de!news From: Dieter Wienrich <dwien@alf.zfn.uni-bremen.de> Newsgroups: comp.lang.modula2 Subject: Re: Arrays of Records and Sequential File Reading Date: 31 Oct 1995 08:57:33 GMT Organization: Universitaet Bremen, Germany Message-ID: <474odt$npe@p235.informatik.uni-Bremen.de> References: <46ngu2$r72@grid.Direct.CA> <DH2EpC.MIo@cix.compulink.co.uk> <472lcc$kdk@grid.Direct.CA> NNTP-Posting-Host: 134.102.88.201 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit