就是上一个题目的改写,灰常简单:

#include <iostream>
#include<string>
using namespace std;


int main()
{
  string cur,pre;
  bool flag = true;
  cout << "Please input string: " ;
  while (cin >> cur )
  {
    if (cur == pre && cur[0] >= 'A' && cur[0] <= 'Z')
    {
		  cout << "The repeat words are "<<cur <<endl;
    }
	else
	{
		cout << "Please input string: " ;
		pre = cur;
	}
  }
 
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2021-08-07
  • 2021-06-08
猜你喜欢
  • 2021-06-28
  • 2021-10-01
  • 2022-02-20
  • 2021-06-15
  • 2021-06-18
  • 2021-11-25
  • 2022-12-23
相关资源
相似解决方案