会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
xilu-H
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2022年6月5日
判断你的计算机是 大端字节序 还是 小端字节序
摘要: #include <stdio.h> union { short value; // 2字节 char bytes[sizeof(short)]; // char[2] } test; int main(int argc, const char * argv[]) { test.value = 0x
阅读全文
posted @ 2022-06-05 22:43 OXYGEN1
阅读(24)
评论(0)
推荐(0)
2022年6月2日
【Linux系统调用】使用open、perror、read、write函数来复制文本文件
摘要: #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(int argc,char *argv[]) { int srcfd = o
阅读全文
posted @ 2022-06-02 17:37 OXYGEN1
阅读(61)
评论(0)
推荐(0)
2022年5月31日
建堆的时间复杂度详解
摘要: https://blog.csdn.net/qq_52433890/article/details/121502538
阅读全文
posted @ 2022-05-31 11:26 OXYGEN1
阅读(16)
评论(0)
推荐(0)
2022年5月29日
右值引用 与 容器
摘要: 右值引用与移动语义使得容器的效率有了大幅提升。 如果传入的为临时变量,自动识别为右值。(下面的类A中没有指针成员变量,没有体现移动构造函数的好处,只是为了演示过程) #include <iostream> #include <vector> using namespace std; class A{
阅读全文
posted @ 2022-05-29 17:11 OXYGEN1
阅读(33)
评论(0)
推荐(0)
2022年5月21日
C++11后生成随机数
摘要: default_random_engine e(time(nullptr)); uniform_int_distribution<unsigned> u(0,9); for (int i = 0;i<10; i++) { cout << u(e) << " "; }
阅读全文
posted @ 2022-05-21 19:18 OXYGEN1
阅读(34)
评论(0)
推荐(0)
2022年5月16日
Variadic Templates(数量不定的模版参数)事例
摘要: #include <iostream> using namespace std; void print() {} template<typename Type, typename... Types> void print(Type firstArg, Types ...args) { cout <<
阅读全文
posted @ 2022-05-16 14:14 OXYGEN1
阅读(19)
评论(0)
推荐(0)
2022年4月18日
判断是不是素数
摘要: //缩小数据范围的暴力算法 bool isPrime(int x) { bool isPrime = true; if (x == 1 || (x%2 == 0 && x != 2)) { isPrime = false; } for (int i = 3; i <= sqrt(x); i+=2)
阅读全文
posted @ 2022-04-18 17:10 OXYGEN1
阅读(17)
评论(0)
推荐(0)
2022年3月15日
【C++】函数对象示例2
摘要: 教材P203 #include <iostream> #include <vector> #include <numeric> using namespace std; //numeric头文件中accumulate的源码: //template <class InIt, class T,class
阅读全文
posted @ 2022-03-15 14:29 OXYGEN1
阅读(30)
评论(0)
推荐(0)
2022年1月18日
scp实现mac与linux服务器之间文件传输
摘要: 1、mac上传文件到linux服务器 scp 文件名 用户名@服务器ip:目标路径如:scp -P端口号 /Users/test/testFile test@xxx.xxx.xxx.xxx:/test/ 2、mac上传文件夹到linux服务器,与上传文件相比多加了-r scp -r 文件夹目录 用户
阅读全文
posted @ 2022-01-18 15:55 OXYGEN1
阅读(43)
评论(0)
推荐(0)
2022年1月12日
Mac配置MySQL环境,解决:mysql: command not found
摘要: 1,安装mysql 2,在终端加入环境路径 如果是bash,执行open ~/.bash_profile;如果是zsh,执行open ~/.zshrc(若提醒无文件,可在对应目录下用touch命令创建文件即可) 添加语句PATH=$PATH:/usr/local/mysql/bin,保存 立即生效:
阅读全文
posted @ 2022-01-12 23:47 OXYGEN1
阅读(71)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告