码迷,mamicode.com
首页 > 编程语言 > 详细

C++primer 10.6节练习

时间:2017-08-15 17:13:18      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:span   unique   ace   dup   return   fstream   over   names   word   

练习10.42

 1 #include<iostream>
 2 #include<string>
 3 #include <iostream>
 4 #include <string>
 5 #include <vector>
 6 #include <algorithm>
 7 #include <list>
 8 #include <functional>
 9 #include <iterator>
10 #include <fstream>
11 using namespace std;
12 using namespace placeholders;
13 
14 void elimDups(list<string> &words);
15 
16 int main()                
17 {
18     list<string> words{ "the","quick","red","fox","jumps","over","the","slow","red","turtle" };
19     elimDups(words);
20     system("pause");
21     return 0;
22 }
23 
24 void elimDups(list<string>& words)
25 {
26     words.sort();
27     words.unique();
28     for (auto c : words)
29         cout << c << " ";
30     cout << endl;
31 }

 

C++primer 10.6节练习

标签:span   unique   ace   dup   return   fstream   over   names   word   

原文地址:http://www.cnblogs.com/wuyinfenghappy/p/7365872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!