c++
saxxxxy
这个作者很懒,什么都没留下…
展开
-
C++new和delete重载
本文主要介绍new和delete在全局和类里面的重载,以及重载的一些细节 #include "stdafx.h" #include #include #include using namespace std; void operator delete(void *p)// p 要释放的内存首地址 { cout free(p); }; void原创 2015-08-04 12:24:31 · 440 阅读 · 0 评论 -
乘法通过查表实现
本文主要通过小学学的99乘法表实现 // 乘法原始实现.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; int array_result[10][10]={ {0,0,0,0,0,0,0,0,0,0}, {0,1,2,3,4,5原创 2015-08-04 15:12:25 · 634 阅读 · 0 评论 -
2015-8-18数据结构-分冶-整数划分问题
#include "stdafx.h" #include #include using namespace std; //把n划分为若干等份,满足:最大加数 int cal_unit_count(int n,int m){ if(m return 0; } if(m==1||n==1){ return 1; } else if(m>n){ return cal_unit_原创 2015-08-18 11:31:27 · 388 阅读 · 0 评论 -
2015-8-18数据结构-动态规划-矩阵乘法次数最少
数据结构-动态规划-矩阵乘法次数最少 #include "stdafx.h" #include #include using namespace std; void MatrixChain(int p[], int n,int m[][6],int s[][6]){ int i,j,r,k,t; for(int i=0;i m[i][i]=0;原创 2015-08-18 18:35:58 · 1166 阅读 · 0 评论 -
2015-8-19数据结构学习-哈夫曼树
// 哈夫曼树.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #define N 6 #define M 2*N-1 #define EPS 1e-5 #define random(x) (rand()%x) using namespace std; typedef char datatype; typ原创 2015-08-19 17:27:25 · 397 阅读 · 0 评论 -
C++,传递多个参数
include "stdafx.h" #include #include #include using namespace std; #include template NT sum(int count,NT data1 ...)//累加 { va_list arg_ptr;//参数列表的指针 va_start(arg_ptr, count);//限定从原创 2015-09-13 11:30:53 · 3344 阅读 · 0 评论 -
C++---处理宽字符
#include "stdafx.h" #include #include #include Int main(){ //setlocale(LC_ALL,"chs"); //wchar_t *p=L"粗粗1256ghfghhhhhhhhhhhhhhhhhhhhhh465"; //wcout //cout //return 0; //}原创 2015-09-13 11:23:32 · 414 阅读 · 0 评论 -
C++虚函数表
// 尹成学习虚函数表.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include using namespace std; typedef void(*Fun)(void); class father{ public: virtual void swim(){ cout } void play(){ cout原创 2015-09-13 09:54:05 · 367 阅读 · 0 评论 -
C++ 利用类模板---类继承形成多态----的一个异常处理结构
#include "stdafx.h" #include using namespace std; template class wrong{ public: virtual void show(){ cout } }; template class small:public wrong{ public : int a; small(int d)原创 2015-09-13 10:04:58 · 318 阅读 · 0 评论 -
C++----自己实现的链表
#pragma once template class Node { public : T t; Node*pNext; }; #include "StdAfx.h" #include "Node.h" #pragma once #include"Node.h" #include using namespace std; template原创 2015-09-13 10:38:04 · 357 阅读 · 0 评论 -
C++-----自己写的哈希表
Node.CPP #pragma once template class Node { public: public: int key; int key1; T data; int count; Node *panother; }; Nodeh #include "StdAfx.h" #include "Node.h" MyHash.原创 2015-09-13 11:09:36 · 908 阅读 · 0 评论 -
C++-----利用括号递归实现的加减乘除
// 二叉树加减乘除.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include using namespace std; struct record{ double value; int pos; }; double calc(double a1,double a2,char c){原创 2015-09-13 11:12:52 · 922 阅读 · 0 评论 -
c++运算符重载,输出符号重载
运算符重载原创 2015-08-03 23:27:00 · 1978 阅读 · 0 评论 -
C++调用函数是如何返回临时对象的
请看如下代码 #include "stdafx.h" #include using namespace std; class INT { friend ostream& operator public: INT(int i) :m_i(i) { cout } INT(const INT&other) { this->m_i = other原创 2017-03-07 18:03:25 · 2237 阅读 · 0 评论 -
kmp算法学习
kmp算法c++原创 2015-07-21 17:27:38 · 509 阅读 · 0 评论