【发布时间】:2016-08-12 12:38:43
【问题描述】:
我有一个向量,用户输入一些字符串。我想保持用户输入的顺序,但删除任何重复的单词。我在网上唯一能找到的是排序和独特的,但由于我无法对向量进行排序,所以我被卡住了。预先感谢您的任何帮助。
例如 来自用户的输入 -> hello there dog cat hello cat book
vector 应该有 -> hello there dog cat book
我现在只有……
string s;
vector <string> myVec;
while (cin >> s){
myVec.push_back(s);
}
{code to sort vector}
【问题讨论】:
标签: c++