chapter4-10.cpp

来自「STL程序员开发指南源码」· C++ 代码 · 共 19 行

CPP
19
字号
//文件名:CHAPTER4-10.cpp
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void listWords(istream& in, ostream& out)
{
      string s;
		unsigned int size=0;
      vector<string> v;
      while (size<2){in >> s; v.push_back(s); 	size++;}
        sort(v.begin(), v.end());
        vector<string>::iterator e= unique(v.begin(), v.end()); 
        for (vector<string>::iterator b = v.begin(); b != e; b++) { out << *b << endl; }
}
void main()
{ listWords(cin, cout);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?