C++笔记:习题 6.20

/* C++ Primer 习题 6.20
 * By Ceeji
 */
 
#include <iostream>
#include <string>
 
using namespace std;
 
int main()
{
	string s, s1;
	s1 = "";
	while (cin >> s)
	{
		if (s == s1)
		{
			cout << "Same: " << s << endl;
			break;
		}
		s1 = s;
	}
	if (s != s1)
		cout << "No Same words." << endl;
}

本文版权遵循 CC BY-NC-SA 4.0发布,转载需附带本文链接。

当前页阅读量为: