- 博客(34)
- 收藏
- 关注
原创 初级算法——排序和搜索
1.合并两个有序数组(1)先合并在排序class Solution {public: void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) { for (int i = 0; i < n; ++i) { nums1[m + i] = nums2[i]; } sort(nums1.b
2022-04-28 20:50:47
176
原创 数据结构——树
1.二叉树#pragma once#include<iostream>using namespace std;#include"顺序栈.h"#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define OVERFLOW -2#define INFEASIBLE -1#define MAXSIZE 100typedef int Status;typedef char ElemType;//二叉树的定
2022-04-16 16:10:39
657
原创 数据结构——数组
#pragma once#include<iostream>using namespace std;#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define OVERFLOW -2#define INFEASIBLE -1#define MAXLEN 255typedef struct{ char ch[MAXLEN + 1]; int length;}SString;int index(S.
2022-04-12 22:54:10
387
1
原创 C++ primer习题记录——第十七章
17.1:#include<iostream>using namespace std;#include<tuple>int main(){ tuple<int, int, int> t(10,20,30); cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl; r..
2022-03-31 22:16:07
921
原创 C++ primer习题记录——第八章
8.1:#include <iostream>using namespace std;istream& func(istream& is){ string str; while (is >> str) { cout << str << endl; } cout << is.good() << endl; is.clear(); cout << is.good() <<
2022-03-16 15:28:25
501
原创 C++ primer习题记录——第六章
6.3:#include <iostream>using namespace std;int fact(int val){ int ret = 1; for (int i = 1; i <= val; i++) { ret *= i; } return ret;}int main(){ int v = fact(10); cout << v << endl; return 0;}6.4:#include <
2022-03-14 18:28:39
1514
原创 C++ primer习题记录——第二章
2.8:#include <iostream>using namespace std;int main(){ cout << "\62\115\012"; cout << "\62\t\115\012"; system("pause"); return 0;}2.19:引用是已存在对象的另一个名称。 指针本身就是一个对象。初始化后,引用仍然绑定到其初始对象。 无法重新绑定引用以引用不同的对象。 可以分配和复制指针。引用总是获取引用最
2022-03-08 23:19:41
401
原创 前置递减和后置递减重载
#include<iostream>using namespace std;class myinteger{public: myinteger& operator--() { this->m_a--; return *this; } myinteger operator--(int) { myinteger temp = *this; this->m_a--; return temp; } int m_a;};ost.
2022-02-23 00:57:03
286
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人