摘要: python的安装 想要学习什么,只有将自己置身于那个环境中才可以。 那么学习python,就首先需要配置python的环境。 安装python python是一个脚本语言,不同于C/C++那种编译生成的语言,也就是说python需要一个解释器,可以实时对编写的代码进行解释,要安装python其实就 阅读全文
posted @ 2023-12-12 11:31 zxinlog 阅读(20) 评论(0) 推荐(0)
摘要: 把C语言中的面向过程的线程,在C++中以面向对象的形式进行封装调用。 Thread.h /* * Thread.h * Copyright (C) 2023 zxinlog <zxinlog@126.com> * * Distributed under terms of the MIT licens 阅读全文
posted @ 2023-09-13 15:57 zxinlog 阅读(27) 评论(0) 推荐(0)
摘要: 观察者模式,也称发布订阅模式,主题方发布,观察方订阅。 observe.h /* * * Copyright (C) 2023-09-13 14:06 zxinlog <zxinlog@126.com> * */ #include <func.h> #include <iostream> #incl 阅读全文
posted @ 2023-09-13 14:28 zxinlog 阅读(17) 评论(0) 推荐(0)
摘要: ## bind ### 1. 介绍 bind 可以改变函数的形态,可以将一个函数改变成另一个函数的样式,但只能减少原函数的参数个数,不能增加。 ```cpp 如此处,int add(int, int), 使用bind可以绑定成一个 f 形式,原来的add的两个参数以10,20填入。bind的第一个参 阅读全文
posted @ 2023-08-29 21:21 zxinlog 阅读(105) 评论(0) 推荐(0)
摘要: 堆是以二叉树为结构组成的一个序列,一般以数组进行实现,如设 N = 1 为根节点,则左节点 `2*N`,右节点 `2*N+1`,以此构建一整个堆。 ## 堆结构体的数据结构 ```c typedef int Item; typedef struct maxHeap { Item* data; // 阅读全文
posted @ 2023-08-28 16:00 zxinlog 阅读(16) 评论(0) 推荐(0)
摘要: ## 选择排序 ```c 指针表示法 void choose_sort(int* arr, int n) { for (int i = 0; i 0;i--){ for(int j=0;j arr[j+1]){ swap(arr,j,j+1); } } } } ``` ## 模板(泛型) ```cp 阅读全文
posted @ 2023-08-28 15:59 zxinlog 阅读(14) 评论(0) 推荐(0)
摘要: ```c /* * * Copyright (C) 2023-08-18 13:51 zxinlog * */ #include #define N 1000 // 普通Node typedef struct Node { int key; int value; struct Node *prev; 阅读全文
posted @ 2023-08-19 15:42 zxinlog 阅读(15) 评论(0) 推荐(0)
摘要: ```c /* * * Copyright (C) 2023-08-16 14:22 zxinlog * */ #include // 定义结构体 typedef struct vector { int *start; int *finish; int *end_of_storage; } Vect 阅读全文
posted @ 2023-08-16 15:23 zxinlog 阅读(22) 评论(0) 推荐(0)
摘要: # IO 多路复用模型 ## 1. select 为了能够完成IO多路复用机制,可选用 select 函数。 nfds 所监听的最大的文件描述符+1(用来限定范围) fd_set 文件描述符集合 timeout 超时时间 FD_ZERO 清空监听队列,初始化 FD_SET 加入一个 fd 到 fds 阅读全文
posted @ 2023-08-08 20:54 zxinlog 阅读(38) 评论(0) 推荐(0)
摘要: ### MutexLock.h ```cpp /* * MutexLock.h * Copyright (C) 2023 zxinlog * * Distributed under terms of the MIT license. */ #ifndef __MUTEXLOCK_H__ #defin 阅读全文
posted @ 2023-08-07 10:46 zxinlog 阅读(24) 评论(0) 推荐(0)