File Search help 
Author Message
 File Search help

Hi  i have this assigment i'm suposed to open a file containg a lot of
words,
have the user enter a string  and see if that string is an actual word. if
it is, print out the word before that, the word, and the word after that.

it should be a little like this

enter a string :
      arichocke
program should output

      artiad           -  word before
      arichocke     - word
      article           - word after

can any one give a hand please thanks.




Wed, 18 Jun 1902 08:00:00 GMT  
 File Search help

Quote:
> Hi  i have this assigment i'm suposed to open a file containg a lot of
> words,
> have the user enter a string  and see if that string is an actual word. if
> it is, print out the word before that, the word, and the word after that.
> it should be a little like this
> enter a string :   arichocke
> program should output
>       artiad           -  word before
>       arichocke     - word
>       article           - word after
> can any one give a hand please thanks.

   A hand...or the complete program?  Since you haven't shown us any of
your own work, what should you expect from your query?  The fact is, it
looks as though you're only looking for some fool to write the whole
program for you, so you can turn it in as your own work.  Is that how you
expect to do such tasks throughout your life - to ask and ask until
someone naive enough does your work for you?
   Well, I (and most regulars in these NGs) won't do that.  However, I'll
give you this, which is more than you really deserve:
   If you were given this task and you _didn't_ have to write a Pascal
program to do it, how would you tackle it?  I mean, if all you were given
were a list (on paper) and had someone submit a word, what
logic/processing steps could _you_ use to find a match and produce the
needed results?  Given such an approach, try to write down the specific
details steps you'd do...and then convert those same steps into Pascal
code.
   You might be really surprised what a small amount of thinking,
planning, and effort might do when you work on problems such as these
assignments.  Didn't your teacher suggest this sort of problem-solving
approach?


Wed, 18 Jun 1902 08:00:00 GMT  
 File Search help
0)
  If you have already written something, post it here,
  so that we know whether there is bug or not

0.5) If you want someone to write the whole program for you:
  sorry, this is not the right place. Try to search for
  pascal source code library homepages on the web.

1)
  If you are able to do half of the job, that is:
  { given a word, you can print the word itself
  { and the word immediately AFTER it
  then you may post the code here. we will add some
  line to it so that it can also print the word
  BEFORE the given word.

  { the idea is to keep a copy of the LAST word
  { encountered by the program. if the word is found,
  { print also the LAST word.

2)
  If you do not know how to do any of the jobs below:

a) separate lines of text into discrete WORDS

Quote:
>> each character in the string is checked, if there is

   a chain of alphabets and then followed by a non-alpha,
   then you know it is a word

b) open and read a file

Quote:
>1> declaration:  var file_identifier:text; {a text file}

    to open a file:

      assign(file_identifier,'yourfile.txt');
      reset(file_identifier);
   {this two lines work together to open a file. RESET means the file is
being read }

      readln(file_identifier,Vstring,Vinteger,Vreal.....)
{ mimics readln(Vstring,Vinteger,Vreal...) as if the file is typed into the
keyboard
  Note: in this program task, you only need to read in one string. }

      close(file_identifier); {close the file}

Quote:
>2> ask your teacher or friends. or look up from textbook.

    be quick, since it takes time to learn the syntax

Armel Abidi ???g??31 ...

Quote:
>Hi  i have this assigment i'm suposed to open a file containg a lot of
>words,
>have the user enter a string  and see if that string is an actual word. if
>it is, print out the word before that, the word, and the word after that.

>it should be a little like this

>enter a string :
>      arichocke
>program should output

>      artiad           -  word before
>      arichocke     - word
>      article           - word after

>can any one give a hand please thanks.





Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need : Recursive file search/directory search

2. Need help with searching a file.

3. Help with searching files of records!

4. Searching .db File

5. searching .dat file

6. File Search

7. Search in Files - Bug ?

8. how to search a file including all subdirs?

9. Searching for a component .......................... CAD-file viewer

10. Newbie Question. [Searching a dBase File]

11. Accesing files/searching

12. Searching a text file

 

 
Powered by phpBB® Forum Software