so basically i have a load of words in my vector and i need to find words that contain "ly" how do i go about trying to do a find_if algorithm. also is it possible for me to use the same algorithm to find words that are longer than 7 letter by simply changing the the varible from ly to >= 7
Your original dictionary is:
abaca
The Manila-hemp plant (Musa textilis); also its fiber. See Manila hemp under Manila.
n
abacinate
To blind by a red-hot metal plate held before the eyes.
v
abacination
The act of abacinating.
n
bleeping
damned.
adj
blemishless
Without blemish; spotless.
adj
blendous
Pertaining to consisting of or containing blende.
adj
Contains 'le':
bleeping
blemishless
blendous
At least 9 letters:
abacinate
abacination
blemishless
Your code already finds words that contain "le" and words whose length is >= 9. It's trivial to change to code to find words containing "ly" and words whose length is >= 7
copy_if(words.begin(), words.end(), back_inserter(ly), [](const string& x) { return x.find("ly") != string::npos; });//looks for words with "ly" in them
for (const string& s : ly) cout << " " << s << '\n';//Prints it out