In the way I have implemented it, perhaps wrong, I can store a word that occurs several times on a line. The question is how to distinguish between the 1rst, 2nd and 3rd occurance? I have an ordered list so if the program could ask I want the occurance after the first, I could return the second. But as specified in the handout, we are only passed in the line number, not the specific occurance.
So in my implementation, I did as the homework suggested.
If I have a text file with a single line of text in it, and I do a search, passing in mark = 1, looking for the string Hello, I will return 1. If the program does this in an iterative loop, asking for the next "Hello" starting with the line number I returned (1), I will again return 1...
Here is the sample text file:
"Hello Joe, Hello Fred."
I hope that is fine...
|