随笔分类 - c++
1
摘要:#include<vector> #include<queue> #include<string> #include<binaryNode.hpp> #include<iostream> #include<sstream> template<typename T> class traverse {
阅读全文
摘要:1 #include <iostream> 2 #include<string> 3 #include<binaryNode.hpp> 4 using namespace std; 5 template<typename T> 6 class BST { 7 public: 8 BST() { sz
阅读全文
摘要:1 #include <iostream> 2 #include<vector> 3 #include<binaryNode.hpp> 4 #include<queue> 5 //自己的头文件放最后防止被依赖 6 7 using namespace std; 8 template<class T>c
阅读全文
摘要:1 #include<iostream> 2 #include<string> 3 #include<vector> 4 #include<map> 5 #include<text.hpp> 6 #include<ctime> 7 8 using namespace std; 9 clock_t b
阅读全文
摘要:1 #pragma once 2 #include <initializer_list> 3 struct String { 4 String(const char*s) { 5 c_str = new char[strlen(s)+1]; 6 while (*s) { 7 *(c_str+sz)
阅读全文
摘要:1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 5 6 struct Sort { 7 8 inline void operator()(vector<int>&vec){ 9 for (int N = vec.siz
阅读全文
摘要:#include <iostream> #include <vector> #include<cassert> #include <queue> using namespace std; auto func(vector<int> nums, size_t k) { assert(!nums.emp
阅读全文
摘要:1 #include <iostream> 2 #include <vector> 3 #include <string> 4 #include<random> 5 using namespace std; 6 7 template<class T=long long>class factory {
阅读全文
摘要:1 #include <iostream> 2 #include<binaryNode.hpp> 3 #include<cassert> 4 #include<queue> 5 #include<vector> 6 7 using namespace std; 8 9 template<class
阅读全文
摘要:1 #pragma once 2 template<class T>struct binaryNode { 3 binaryNode() = default; 4 binaryNode(T data, binaryNode<T>* father = NULL, binaryNode<T>* lson
阅读全文
摘要:#include <iostream> #include<algorithm> #include<stack> #include<vector> using namespace std; bool nixu(vector<int>cp) { for (size_t i = 2; i < cp.siz
阅读全文
摘要:1 #include <iostream> 2 #include<my.hpp> 3 using namespace std; 4 5 void line_feed() { 6 cout << endl; 7 } 8 9 template<class T>class List { 10 public
阅读全文
摘要:map<vector<int>::iterator,int*>m; vector<int>vec{ 1,4,31,23,1 }; less<int>s; auto iter = vec.begin(); while (iter != vec.end()) { m[iter] = &(*iter);
阅读全文
摘要:#include <iostream> #include<algorithm> #include<vector> using namespace std; void swap(int& a, int& b) { int t = a; a = b; b = t; } void quicksort(ve
阅读全文
摘要:1. First, write a simple program called null.c that creates a pointer to an integer, sets it to NULL, and then tries to dereference it. Compile this i
阅读全文
摘要:2. Now, run free, perhaps using some of the arguments that might be useful (e.g., -m, to display memory totals in megabytes). How much memory is in yo
阅读全文
摘要:1. Write a program that calls fork(). Before calling fork(), have the mainprocess access a variable (e.g., x) and set its value to something (e.g., 10
阅读全文
摘要:1 auto getter() { 2 return new vector<int>(); 3 } 4 auto setter(vector<int>* vec) { 5 int x; 6 while (cin >> x) 7 vec->push_back(x); 8 return vec; 9 }
阅读全文
摘要:1 void func(forward_list<string>& flst, const string& s1, const string& s2) { 2 auto bb = flst.before_begin(); 3 bool flag = false; 4 for (auto j : fl
阅读全文
1