Keep a count with the target_strings (terms) in a map. If you get results from a search term, you take pResults + 1 and search again, adding to the count for that term, looping with this until strstr() returns null. Then you go to the next term, and start again. So, this can be done in a dual nested loop, the outer iterating through the map of terms, and the inner searching for that term until null is returned by strstr(). Try this, and show what you have done for that algorithm.
Gà_1 commented: Seem that your method is for counting (find pos) at characters. Can you please expain more about how this method work at counting at words(in OP's pb) +0
Gà_1 commented: Much better than my idea. But can you please explain more how can we find "position by number" using strstr(). +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster