/**
* c++ primer 5.21
*
**/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// qwe qsd axcv fgds fhfgh q e rt q e rt ASX AZS aSQ Qa Qa
string buf, mstr;
vector<string> str;
bool status = false;
while (cin >> buf && !status) {
if (buf[0] < 'A' || buf[0] > 'Z') {
continue;
}
for (auto i : str) {
if (i == buf) {
mstr = buf;
status = true;
break;
}
}
str.push_back(buf);
}
if (status) {
cout << "首字母大写并且重复出现的单词是:" + mstr << endl;
} else {
cout << "没有任何单词是连续重复出现的" << endl;
}
return 0;
}
c++ primer 练习5.21
最新推荐文章于 2024-01-09 08:27:28 发布