vector真心是个好东西,好想对她说:你怎么这么优秀呢
慢慢来,会好的
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
vector<string> text;
string word,temp;
while (cin >> word)
{
text.push_back(word);
}
auto beg = text.begin();
auto end = text.end();
while (beg != end)
{
if (*beg == temp)
{
cout << "重复出现的单词是:" << *beg<<endl;
break;
}
else
{
temp = *beg;
beg++;
}
}
if (beg == end)
{
cout<<"没有重复的单词"<<endl;
}
system("pause");
return 0;
}