
C++
xqn2017
大家好,我是一名目前在上海工作的入门码农,写博客是为自己的学习过程做个记录,同时也希望能认识更多的IT爱好者一起探讨技术或者生活琐事,有希望认识的同学可以加我QQ:380191204
展开
-
C++学习笔记
1、const限定符const限定变量的值不可变,并且const对象必须要初始化const int buf = 512; //正确,表明buf的值为512buf = 400; //错误,buf的值不可变const int temp; //错误,必须要初始化2、引用引用必须要初始化,且初始化为对象,类型一致,引用只是给已经存在的对象取另一个名字,不是对象原创 2017-04-11 20:53:11 · 373 阅读 · 0 评论 -
C++学习二分查找
直接看代码吧!#include #include #include #include using namespace std;int main(){ vector v1; vector::iterator start; vector::iterator end; vector::iterator mid; int loop = 0; int key = 11;原创 2017-04-14 16:54:43 · 225 阅读 · 0 评论 -
根据前序和中序遍历重建二叉树
#include "stdafx.h"#include #include #include using namespace std;/* 重建二叉树题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树. 假设输入的前序遍历和中序遍历的结果中都不含重复的数字.例如 输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,转载 2017-08-22 10:47:51 · 213 阅读 · 0 评论 -
windows下多线程简单demo
#include #include #include using namespace std;int tickets = 100;HANDLE hMutex;DWORD WINAPI Fun1Proc(LPVOID lpParameter){ while (true) { WaitForSingleObject(hMutex, INFINITE); //请求互斥量访问权转载 2017-08-26 11:12:28 · 340 阅读 · 0 评论 -
C++中文件读写的操作
在C++中读读写文件一般指的就是磁盘中的文本文件和二进制文件:文本文件:以字符序列组成的文件二进制文件:由二进制组成的文件读写文件采用ofstream和ifstream文件流,两者可用头文件包含,具体代码如下:#include #include #include using namespace std;int main(){ ofstream out;//输出文件原创 2017-11-23 11:28:52 · 2646 阅读 · 0 评论