CIS 275 Lab 6

Points: 25 Due Date: End of term
This will require you to modify an existing program. We will start with the code from the maptest example. This code takes a file of text and reads it in, breaking it up into words and storing the words in a map. If it sees a word that is already there, it bumps a counter for that word. At the end, it prints the list of words and the number of times each appears. It also prints some other stuff that isn't important here.

What I want you to do is to alter the program so that in addition to the count of appearances of each word, it keeps track of what lines the word appears on. To do this, you will have to alter the word class to use a vector or a list container. Every time you see a word, you have to add the line number to the container. Only add a line number once for each word. For example, in the line below, the word the appears several times but the line number should only be in the list for 'the' once.

That is in the line below, the word the appears several times but the
If you want to do a little research on your own and study the set container described in Chapter 15, you can use that.

You should alter the print routine to show the line numbers for each word.

For 5 points, write a function that takes a line number as an argument and prints the words that appear on that line. I have written a solution to this and the example executable and data file are in this zip file. Running it may help clarify what I want.

If you have questions, just ask.