I want to find the occurances of a list of words(eg: MTR, UK, USA, MAC, MS, DHL) in an array, thus, I make use of a strstr() function. However, the function can only accept matching one element a time, how can I match a list of word by using strstr()?
Here's my code
char str = "Making Simple Things Simple. With todays programming languages, most people find it very difficult to do even simple things.";
pch = &str;
while ( pch != NULL )
pch = strstr (pch,"simple"); // for instance: How can I match "simple" and "difficult" by using only one strstr expression at a time?
if ( pch != NULL )
cout << pch;
pch = &pch[0+6];