So, as per my self-study of vectors, I was testing to see if I could manage to blacklist a set of words, then build a vector from user input and then 'bleep' out any words from the blacklist while outputting the contents of the vector. You may recognize this from 4.7 of Stroustrup's 'Programming: Principles and Practice Using C++'.
So, I want to modify this to allow the user to, prior to entering words into the vector 'words' to build the vector 'disliked' through the console input. Now, the code below works, but I can't seem to figure out (after looking extensively) how to compare 'words[i]' with each element of the 'disliked' vector without defining each of them. While each element of 'disliked' is predefined, this isn't a problem, but if I want to add the code to allow the user to push_back new strings into 'disliked', then it will become a problem.
I tried adding an additional: for(int x = 0; x < disliked.size(); ++x) after the initial for statement, but that merely led to repeating the output of most of the words (including some that should have been 'bleeped' out). Is there a simple way to replace the complex if statements containing each element of 'disliked' with something simple which compares words[i] against each element of 'disliked' from 0 up to disliked.size() and doesn't multiply my output?
Okay, then it is as I had presumed. There are simpler ways to accomplish this task, but they rely on operators and other things I haven't gotten to yet. Where I am up to hasn't dealt with iterators yet, nor have I seen anything like string& yet.
That being said, I'm seeing some helpful logical tidbits among both of your code that I will likely refer back to. Thank you both for your comments.