I have a vector that the user enters some lines. I want to keep the order that the user enters, but removes any duplicate words. The only thing I could find on the Internet was sorting and uniqueness, but since I cannot sort the vector, I was stuck. Thanks in advance for any help.
ex user login → hello there dog cat hello cat book
the vector must have → hello there dog cat book
right now everything i have ...
string s;
vector <string> myVec;
while (cin >> s){
myVec.push_back(s);
}
{code to sort vector}
source
share