Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 3 Forum
Date: Thu Sep 27 2001 11:49 am
Author: White, David <white3@andrew.cmu.edu>
Subject: Re: search function

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...

Post response

Go to the previous messageGo to the following message
Current Thread Detail:
search function      Durham, Patrick K.      Wed Sep 26 2001 2:22 pm       
Re: search function      White, David      Wed Sep 26 2001 3:31 pm       
Re: search function      Chen, Richard      Thu Sep 27 2001 12:15 am       
Re: search function      Cipriani, Jason A.      Thu Sep 27 2001 11:24 am       
Re: search function      White, David      Thu Sep 27 2001 11:49 am       
Re: search function      White, David      Thu Sep 27 2001 11:52 am       
Re: search function      Danish, Matt R.      Fri Sep 28 2001 11:44 am       
Re: search function      Cipriani, Jason A.      Fri Sep 28 2001 5:32 pm       
Re: search function      Yuen, John      Thu Sep 27 2001 12:06 pm       

Back to previous screen