C++ Primer
RGBMarco
时间能证明一切,如果不能帮助到别人,那就记录自己!
展开
-
C++ Primer(第五版) 6.7练习综合版
//C++ Primer(第五版) 6.7练习综合版 #include#includeusing namespace std;using pfunc = int(*)(int, int);int sum(int,int);int subtract(int, int);//subtract 减 //学编程可以学英语int consult(int, int);// cons原创 2017-03-03 17:48:14 · 554 阅读 · 0 评论 -
c++ primer 13.2.2 13.28
//main.cpp#include#include"TreeNode.h"#include"BinStrTree.h"using namespace std;int main(){TreeNode t1;TreeNode t2(t1);BinStrTree b1;BinStrTree b2(b1);system("pause");return 0;原创 2017-04-03 20:09:33 · 844 阅读 · 0 评论 -
c++ primer 13.2.1 13.25
/*作者:Marco要求:c++ primer 13.2.1 13.25特点:1.定义一个拷贝构造函数,完成vector的拷贝,而不是拷贝指针 2.定义一个析构函数来释放vector shared_ptr可自动释放 3.定义一个拷贝赋值运算符来释放对象当前的vector,并从右侧运算对象拷贝 vector*/#include#include"StrBlob.h"原创 2017-04-02 22:42:35 · 366 阅读 · 0 评论 -
C++ primer 12.2.2
/*12.2.2作者:Marco*/#include#include#include#includeusing namespace std;int main(){allocator alloc;auto p = alloc.allocate(4);string s;auto q = p;auto d = p;/*细节真的很重要这段如果改成原创 2017-04-02 11:41:20 · 394 阅读 · 0 评论 -
c++ primer 12.1.2练习
//12.1.2节练习//练习12.6#include#include#includeusing namespace std;vector* vect(){vector *p = new vector;return p;delete p;}vector* read(vector* vect){auto p = vect;int a;whi原创 2017-04-01 12:40:41 · 471 阅读 · 0 评论 -
c++ primer 一个单词转换的map(自定义版)
#include#include#include#include#include#include#includeusing namespace std;map tomap(const string &rule){map keys;ifstream in(rule);string line;bool first = true;string va原创 2017-03-30 21:16:19 · 304 阅读 · 0 评论 -
c++ primer 11.2.3 11.14练习
#include#include#include#include#include#includeusing namespace std;void add(map >> &a,const string &surname,const string &name,const string &birthday){for(auto &v : a)if (v.first原创 2017-03-30 17:39:22 · 541 阅读 · 0 评论 -
c++ primer 11.2.1节 11.7练习
#include#include#include#include#includeusing namespace std;void add(map> &a,const string &surname,const string &name){for (auto &v : a)if (v.first == surname){v.second.push_back原创 2017-03-30 16:35:49 · 349 阅读 · 0 评论 -
c++ primer 11.2.3 11.12练习
#include#include#include#includeusing namespace std;int main(){vector > a;vector b = { 1,2,3,4,5,6,7,8,9 };vector c = { "1","2","3","4","5","6","7","8","9" };auto it = c.begin();原创 2017-03-30 15:47:57 · 316 阅读 · 0 评论 -
c++ primer 14.8.3
#include#include#include#includeusing namespace std;//普通函数int add(int a, int b){return (a + b);}//lambdaauto minu = [](int a, int b) ->int{return a - b; };//类对象class multilip原创 2017-04-08 12:43:09 · 315 阅读 · 0 评论 -
c++ primer 11.2.2练习11.9
#include#include#include#include#include#includeusing namespace std;int main(){ map> a; ifstream in("Text.txt"); string line; string word; string s; cin >> s; size_t n = 0; while (getl原创 2017-03-29 17:30:46 · 479 阅读 · 0 评论 -
STL C++ Primer算法总结(一)
//STL C++ Primer 算法总结(一)#include#include#include//count()#include#include#include//accumulate()#includeusing namespace std;int main(){vector a = { 1,2,3,4,5,6,7,8,9,10 };//find原创 2017-03-12 14:23:15 · 645 阅读 · 0 评论 -
c++ primer 17.4.1节练习
#include#includeusing std::cout;using std::ends;using std::default_random_engine;using std::uniform_int_distribution;void rand_digit(unsigned min, unsigned max, int seed){static defaul原创 2017-04-26 22:44:25 · 316 阅读 · 0 评论