Please can anybody help me? I'm a beginner .
 I need to write a c++ program that does the following :

1. Ask the user to enter two text file , the the first one contains a list of words in one column Regardless of their number , second one contains the text file    ,like this:
        //output

   Enter the keywords file: keywords_file.txt
   Enter the text file: text_file.txt

   2.Search for the keywords from the keywords file in the text file

    3.if the keyword exist the output =1 "true", if the keyword doesn't exist output =0 "false" ,like this :

    system  : 1  //its exist

   book : 0   //its doesn't exist



   4.  Then output in new text file (ofstream)


   I put the words in file each one on its own line because some of them are phrases I don't want to sprit them ,search them as one word , also the test            file I want it to stay as complete text not separate words from each other so possibly I cant use "map" & "vector". I already tried them...so possibly I can consider that each word in the words file just a line and read them all , then search for them in the text file

Recommended Answers

This needs more definition. I think you meant "split" where you wrote "sprit." If I guessed wrong then I will be wrong here.

  1. I will not attempt to write your code for you. This is your assignment, not mine.
  2. You need to define that "split" carefully. Examples:
    a. "This …
Jump to Post

All 2 Replies

This needs more definition. I think you meant "split" where you wrote "sprit." If I guessed wrong then I will be wrong here.

  1. I will not attempt to write your code for you. This is your assignment, not mine.
  2. You need to define that "split" carefully. Examples:
    a. "This matches?" in the keyword file does or does not have to search across lines in the text file.
    b. "This matches does have to match across linefeed/carriage returns (harder but not that much.)

Break down the problem to steps. For example you must be able to code on your own the first part where you read a line from your keyword file. Then you test that before you work out how to look for a match in the text file.

Do that first.

commented: yes , its split ,i will try with its , if i faced any problem will you help me? +0

From your comment, I might help. If I'm in town, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.