C++primer习题3.21

来源:转载

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

#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; } } }


分享给朋友:
您可能感兴趣的文章:
随机阅读: