随笔分类 - 编程
摘要:1 // ConsoleApplication1.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include<iostream> 6 #include"TEST2.h" 7 #include<exception> 8 using name
阅读全文
摘要:1 #pragma once 2 #include 3 template 4 class CLineList{ 5 private: 6 T1* pData; 7 T1 nCount; 8 int nTabLenth; 9 10 public: 11...
阅读全文
摘要:1 #pragma once 2 template 3 class CMyVector{ 4 private: 5 int m_nLenth;//长度 6 int m_nCount;//元素个数 7 T* m_pVec;//指针 8 public: 9 ...
阅读全文
摘要:1 #pragma once 2 //首先建立树节点的类型 3 //一个树节点有数据域,有指向左子树的指针域,有指向右子树的指针域 4 //我们将其封装成一个结构体类型 5 class DoubleTree{ 6 public: 7 typedef struct _DOUBLENODE{ ...
阅读全文
摘要:首先定义一个类,相关数据,函数封装,在头文件中#pragma onceclass SingleList{public: typedef struct _NODE{ int nData; //数据域 _NODE *pNext; //指向下一个节点 ...
阅读全文
摘要:1 // 2 //map是一个标准的关联式容器,一个map是一个键值对序列,即(key,value)对。 3 //它提供基与key 的快速检索能力。map中key值是唯一的。 4 //集合中的元素按一定的顺序排列。元素插入过程是按排列规则插入,所以不能指定插入位置。 5 //map具体实现采用红黑...
阅读全文
摘要:1 //双向链表list的使用 2 //高效插入删除,若只是尾部插入删除元素,优先考虑vector 3 //若仅于头尾两端增删元素,优先考虑deque 4 #include "stdafx.h" 5 #include 6 #include //使用list之前,必须包含头文件...
阅读全文
摘要:1 //vector 当作数组应用 2 #include "stdafx.h" 3 #include 4 #include //第一步包含头文件 5 using std::vector; //第二步命名空间 6...
阅读全文
摘要:#include "stdafx.h"#includeint _tmain(int argc, _TCHAR* argv[]){ //动态内存的分配,必须清楚的是,分配后返回的必然是一个地址,即一个指针 //动态内存分配,第二点必须要说明分配大小,分配类型应该与返回类型一致 //第三点,动态内存,由...
阅读全文
摘要:#include "stdafx.h"#includeint _tmain(int argc, _TCHAR* argv[]){ char string_a[10] = "hello"; char *string_p = "hello"; int a[10] = { 12, 12, 12, 12,...
阅读全文
摘要:在程序中,对于数据,我们有一种数据希望给定了,就不会改变。书上常拿圆周率来举例!我们把这类一开始就给定的数据,并且在程序运行过程中不改变的数据称为常量。那么这里 也就说明了,如果要用const ,那么你要保证你那个数是个常量。第一点:既然是不变,而我们又知道它的值,那么我们必须对他初始化。以后不能改...
阅读全文

浙公网安备 33010602011771号