- 博客(24)
- 收藏
- 关注
原创 C++模板板块
#pragma once#include #include template >class stack{public: stack():element(){}; ~stack() { } void push(const T &elem) { element.push_back(elem); } void Pop() { el
2016-02-27 00:50:05 290
原创 算法 小端排序
#include using namespace std;void moHosrt(int a[],int t,int n){ int i, j; for (i = t, j = i * 2+1; j < n; i = j, j = j * 2+1) { if (ja[j]) { j++; } if (a[i] < a[j]) { swap(a[i]
2016-02-27 00:44:28 338
原创 算法排序 归并 理解性写
#include using namespace std;void myswap(int a[],int l,int m,int r,int *&b){ int p = 0; int i=l, j = m + 1; while (i <= m&&j <= r) { if (a[i] < a[j]) { b[p++] = a[i++]; } else
2016-02-27 00:43:07 244
原创 算法 排序 快排
#include #include void mysort(int *a, int low, int m){ int shang = low; int xia = m; int temp = a[shang]; while (shang < xia) { while (shang temp) xia--; a[shang] = a[xia]; while
2016-02-27 00:41:04 242
原创 参考书本 背包问题
#define _CRT_SECURE_NO_WARNINGS#include #include int x[100] = { 0 }; //数组X用来存放路径int val[100] = { -1 };//物品单价int weight[100] = { -1 };//存放物品的重量int isOverLoad(int n, int c){ int i, w = 0
2016-02-27 00:36:43 331
转载 c 数据算法参考书本 跳斑马
#include #include #define X 8#define Y 8int chess[X][Y];int nextxy(int *x, int *y, int conut){ switch (conut) { case 0: if (*x + 2 = 0 && chess[*x + 2][*y - 1] == 0) { *x = *x + 2;
2016-02-27 00:35:25 316
原创 C++ 2杈树 完整
#ifndef RB_H_#define RB_H_#include #include template class RB;templateclass Node{ friend RB;private: Node() :zuo(0), you(0),data(0){} Node(T *&s):data(s),zuo(0),you(0){} ~Node(){ delete
2016-02-27 00:21:48 329
原创 C++ 红黑树
#ifndef WRAPPER_H#define WRAPPER_H#include "Except.h"templateclass Cref{public: Cref() :obj(NULL){} explicit Cref(const Objct &x) :obj(&x){} const Objct &get()const { if (usNull())throw N
2016-02-27 00:14:55 317
原创 C ++ 面向对象 简单写sqlite3 数据库
#define _CRT_SECURE_NO_WARNINGS#include#include #include #include #include using namespace std;extern "C"{ #include "sqlite3.h"};class stds{public: stds() : sql("create table if no
2016-02-27 00:09:13 344
原创 C++ 酒桶算法
templateint maxlen(T *data,const int n){ int p = 10; int d = 0; for (int i = 0; i < n; i++) { while (data[i] >= p) { p *= 10; ++d; } } return d;}templatevoid readsort(T data[],
2016-02-27 00:06:11 680
原创 C++ 造房子list
#pragma oncetemplateclass Clist{public: Clist(); ~Clist(); Clist(const T *data); Clist(const Clist &ls); bool Push_bak( T *const data);//后插 bool Push_first(T*const data);//前插 bool Push_ba
2016-02-26 23:59:29 691
原创 C 语言算法排序 希尔
#include#include#includevoid shellsort(unsigned int k[], int xia){ int i; int j; int flag; int zhong = xia; int tmp; while (zhong > 1) { zhong = zhong / 2; do { flag = 0; for (i
2016-02-26 23:57:44 260
原创 C 文件 简单整理 根据莫大学毕业项目写
#define _CRT_SECURE_NO_WARNINGS#include "stdio.h"#include "ctype.h"#include "stdlib.h"int main1111(void){ FILE *fpi, *fpo; int ch, f, lch; int dqm, sqm, par,Gh; fpi = fopen("ininin.txt", "r")
2016-02-26 23:40:21 322
原创 C 数据算法 八皇后
#define _CRT_SECURE_NO_WARNINGS#includeusing namespace std;int a[8];int c = 0;int n = 4;bool flag(int pos) { int i; for (i = 0; i < pos; ++i) { if (a[i] == a[pos]) { return false; }
2016-02-26 23:38:45 259
原创 C++数据结构 简单栈 (一贯作风::懒)
#include #include #include using namespace std;templateclass stack{public: stack() :head(0), end(0),top(0){} void Push(T *d); T *Pop(); int len(){ return top; } ~stack() { while (hea
2016-02-26 23:35:19 309
原创 C++数据结构 乱搭配模板迭代
#include #include #include using namespace std;templateclass stack{private: class s { private: T *data; s * zuo; s *you; public: s() :data(0), next(0){} s(T*da):data(da),zuo(0),y
2016-02-26 23:33:04 298
原创 面向对象写的 五子棋(一贯作风::懒)代码懒的规范
#include #include #includeusing namespace std;class data{public: data(int ix, int iy) :x(ix), y(iy){ fl = 0; conut = 0; } virtual ~data(){} virtual int GetX()const { return x; } virtual in
2016-02-26 23:30:23 476
原创 C++ 面向对象写汉罗塔游戏(作风::懒)
#include #include#include using namespace std;class Cstring{private: unsigned int len; char *st; explicit Cstring(const unsigned int i) { len = 0; st = new char[i+1]; return; }publ
2016-02-26 23:24:54 832
原创 C++ 写自己的string类(作风::懒)
#include #include#include using namespace std;class Cstring{private: unsigned int len; char *st; explicit Cstring(const unsigned int i) { len = 0; st = new char[i+1]; return; }publ
2016-02-26 23:22:54 564
原创 学C++ 写面向对象贪吃蛇(作风一贯::懒)
#include #include #include using namespace std;class data{private: int x; int y;public: data(int i, int ff) :x(i), y(ff){ ; } virtual~data(){ cout << "data................\n"; } virtual
2016-02-26 23:21:34 1075
原创 C++模板简单学习
到后面学习开始变懒了 从代码就看出来了#ifndef ARRAY_H#define ARRAY_H#include template class A{ T o[size];public: int length()const { return size; } T &operator[](int i); };template T&A::operator[](int i)
2016-02-26 23:19:40 353
原创 c的简单数据组存储
#ifndef _CLIB__H#define _CLIB__Hstruct Cs{public: void init(int sz); int add(const void *p); void *fin(int n); void insert(int n); int conut(); void clocr();private: int size; int n
2016-02-26 23:15:37 366
原创 学C++第一天 面向对象写2杈
此时此刻没有学到数据结构这块 所以 思想还是停留在C 的坑#include using namespace std;class data{public: data(int i):x(i){} virtual ~data(){ cout << "data.....\n"; } virtual void pint() = 0; int getvalue(){ return
2016-02-26 23:11:14 359
原创 刚学C语言时理解性的写的2杈
#ifndef _SHU_H#define _SHU_H#define _CRT_SECURE_NO_WARNINGS#include #include #include #include typedef struct Node//树{ int data; struct Node *you; struct Node *zuo;}node,*N;typedef struc
2016-02-26 23:01:44 281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人