练习5.21:修改5.5.1(171页)练习题的程序,使其找到的重复单词必须以大写字母开头。
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
string buf, mark;
cin >> mark;
int count = 0;
while (cin >> buf)//&&!buf.empty())
{
if (mark == buf)
{
if (buf[0]<'A' || buf[0]>'Z')
continue;
count++;
cout << buf << endl;
break;
}
mark = buf;
}
if (count == 0)
cout << "There is no same words!" << endl;
system("pause");
}