![](https://img-blog.csdnimg.cn/20190328183412218.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
c++ primer
关于c++ primer第五版的部分练习解答。
光羽隹
继续学习。
展开
-
c++ primer第五版练习19.21 19.23
#include <iostream>#include <string>#include <vector>#include <utility>using namespace std;class Token{public: Token() : tok(INT), ival(0) {} Token(const Token...原创 2019-03-31 20:46:13 · 150 阅读 · 0 评论 -
c++ primer第五版练习5.14
#include &lt;string&gt;#include &lt;iostream&gt;#include &lt;vector&gt;using namespace std;int main(){ int max_cnt=0,cnt=0; string max_word,word,front_word; while(cin&gt;&am原创 2018-12-12 17:46:54 · 462 阅读 · 0 评论 -
c++ primer第五版练习9.28
#include <iostream>#include <string>#include <vector>#include <list>#include <deque>#include <array>#include <forward_list>using namespace std;forwar原创 2019-01-02 16:34:17 · 203 阅读 · 0 评论 -
c++primer第五版练习9.49
好不容易,终于给运行出来了。。。比较重要的是要考虑末尾都是不出头字母的情况。代码如下:#include <iostream>#include <string>#include <vector>#include <list>#include <deque>#include <array>#include <...原创 2019-01-02 23:00:30 · 199 阅读 · 0 评论 -
c++ primer第五版练习18.30
class Class{};class Base : public Class{public: Base():val(0) {} Base(Base &b):val(b.val) {} Base(int b):val(b) {}protected: int val;};class D1 : virtual public Base{publ...原创 2019-03-27 22:32:31 · 124 阅读 · 0 评论 -
c++ primer第五版练习17.23
#include <iostream>#include <regex>#include <string>using namespace std;int main(int argc, char *argv[]){ //分为两个子表达式,分别为(5num)和(-4num) string no = "(\\d{5})([-]?\\d{4})...原创 2019-03-23 22:07:04 · 92 阅读 · 0 评论 -
c++ primer第五版练习17.15
#include <iostream>#include <regex>#include <string>using namespace std;int main(int argc, char *argv[]){ regex r("[[:alpha:]]*[^c]ie[[:alpha:]]*", regex::icase); smatc...原创 2019-03-23 17:51:15 · 157 阅读 · 0 评论 -
c++ primer第五版练习17.11 17.12 17.13
#include <iostream>#include <bitset>using namespace std;template<size_t N>class Quiz{public: Quiz() {} Quiz(const string &s) : bit_quiz(s){} template...原创 2019-03-23 16:42:29 · 180 阅读 · 0 评论 -
c++ pimer第五版练习17.4 17.5 17.6
#include <iostream>#include <tuple>#include <string>#include <vector>#include <algorithm>#include "sales_data.h"using namespace std;//使用tupletypedef tuple<ve...原创 2019-03-22 22:38:29 · 171 阅读 · 0 评论 -
c++ primer第五版练习16.28
sharedpointer.h#ifndef SHAREDPOINTER_H#define SHAREDPOINTER_H#pragma once#include <functional>namespace cp5{ struct Delete { template<typename T> auto ope...转载 2019-03-20 21:49:34 · 319 阅读 · 0 评论 -
c++ primer第五版练习16.4
#include <iostream>#include <vector>#include <list>using namespace std;namespace cc { template<typename T, typename U> bool find(const T t1, const T t2, const U &a...原创 2019-03-18 21:00:44 · 273 阅读 · 0 评论 -
c++ primer第五版练习14.44
#include <iostream>#include <string>#include <functional>#include <algorithm>#include <map>using namespace std;int add(int a, int b){ return a+b;}auto mod =...原创 2019-03-12 21:30:57 · 184 阅读 · 0 评论 -
c++ primer第五版练习13.34、36、37
#ifndef MESSAGE_H#define MESSAGE_H#include <set>#include <string>using namespace std;class Message;class Folder{public: Folder() {} Folder(const Folder&); Folder&...原创 2019-03-06 21:23:43 · 197 阅读 · 0 评论 -
c++ primer第五版练习12.20
建立了如下文件:strblob.h文件#ifndef STRBLOB_H#define STRBLOB_H#include &lt;string&gt;#include &lt;vector&gt;#include &lt;initializer_list&gt;#include &lt;memory&gt;using names原创 2019-03-01 17:19:21 · 369 阅读 · 1 评论 -
c++ primer第五版练习12.7
#include &lt;iostream&gt;#include &lt;vector&gt;#include &lt;memory&gt;using namespace std;shared_ptr&lt;vector&lt;int&gt;&gt; build_vec(){ int x; vector&am原创 2019-02-27 19:30:50 · 240 阅读 · 0 评论 -
c++ primer第五版练习12.6
#include &lt;iostream&gt;#include &lt;vector&gt;using namespace std;vector&lt;int&gt;* build_vec(){ int x; vector&lt;int&gt; v1; while(cin&gt;&gt;x)原创 2019-02-27 19:16:41 · 217 阅读 · 0 评论 -
c++ primer第五版练习11.7
#include &lt;iostream&gt;#include &lt;map&gt;#include &lt;string&gt;#include &lt;vector&gt;using namespace std;int main(int argc, char *argv[]){ map&lt;string, vecto原创 2019-01-28 18:11:08 · 240 阅读 · 0 评论 -
c++ primer 第十章 练习10.24
#include &lt;iostream&gt;#include &lt;string&gt;#include &lt;functional&gt;#include &lt;vector&gt;#include &lt;algorithm&gt;using namespace std;using placeholders::原创 2019-01-27 14:25:10 · 178 阅读 · 0 评论