August 2012
Intermediate to advanced
976 pages
30h 17m
English
To conclude our discussion of the library, we’ll implement a simple text-query program. Our program will let a user search a given file for words that might occur in it. The result of a query will be the number of times the word occurs and a list of lines on which that word appears. If a word occurs more than once on the same line, we’ll display that line only once. Lines will be displayed in ascending order—that is, line 7 should be displayed before line 9, and so on.
For example, we might read the file that contains the input for this chapter and look for the word element. The first few lines of ...
Read now
Unlock full access