Hi..please can anybody help me..im beginner and i have a hard assignment
i need to write a c++ program that do the follwoing :

1.aske the user to enter two text file the first one containe the text file ,the second one contain list of words in one column Regardless of their number
like this :
Enter the text file : text_file.txt
Enter the keywords file : keywords_file.txt

2.search for the keywords from key words file in the text file
3.find the apperancse of each word like this :

system : 55 times
analysis :21 times

4.the output in new text file (ofstream)

Recommended Answers

All 2 Replies

This sounds like we can re-use prior works.

  1. First we need that word count. Here's Rosettacode:
    https://rosettacode.org/wiki/Word_frequency

  2. Now we have those counts, a grep will be fine. Here's an example I can copy and work over:
    https://www.daniweb.com/programming/software-development/threads/152550/how-can-i-grep-a-file-using-c

Remember I take it this is a real need and not homework.

commented: the first one doesn't work as i want..i will try with the second one +0

In regard to "as I want." To me this was a two step solution. Step 1 was to use a common word frequency routing and the second to grep out as required the results of step one.

I'm running into folk that want ready to use code/app for their assignments. For that you head to job sites like Fiverr and others.
Here we discuss possible solutions and when we are really stuck the problem is presented along with what is the issue. If the issue is you need a completed app then it's off to sites that sell such.

Be a part of the DaniWeb community

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