
c++
致~命~伤
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++指针引用和指向指针的指针传输结构体
C++指针引用和指向指针的指针传输结构体#include <iostream>using namespace std;struct teacher { int id; char name[64]; };int tea(struct teacher* &a) {//指针引用,a是c的别名 a = (struct teacher*)malloc(sizeof...原创 2019-04-18 08:52:54 · 1390 阅读 · 2 评论 -
C++装饰器模式
C++装饰器模式#include <iostream>using namespace std;//装饰模式又叫包装模式,通过一种对客户端透明的方式来拓展对象功能,是继承关系的一种替代。//装饰模式就是要把附加的功能分别放在独立的类中,并让这个类包含要装饰的对象class Hero //英雄类{public: virtual void ShowProperty() = 0...原创 2019-06-18 08:30:51 · 620 阅读 · 1 评论 -
C++‘企业’链表
C++‘企业’链表#include <iostream>using namespace std;class Linked{public: Linked* next;};typedef void(*Print)(Linked*);//打印方法函数类型class LinkeStruct {public: LinkeStruct(); ~LinkeStruct();...原创 2019-06-27 20:42:43 · 303 阅读 · 0 评论 -
C++栈的应用_就近匹配
C++栈的应用_就近匹配#include <iostream>using namespace std;#define MAX_SIZE 1024class Stack{public: Stack(); ~Stack(); void push_back(void*); void* Front(); void pop_front(); int GetSize();...原创 2019-06-27 20:44:10 · 251 阅读 · 0 评论 -
C++插入排序
C++插入排序#include <iostream>#include <sys\timeb.h>#include <time.h>using namespace std;#define MAX 10000//插入排序:1、先把数组第一个元素当成有序序列// 2、从第二个元素开始,元素和当前元素的上一个元素进行比较,符合条...原创 2019-07-07 08:54:10 · 249 阅读 · 0 评论 -
C++希尔排序
C++希尔排序#include <iostream>#include <time.h>#include <sys/timeb.h>using namespace std;#define MAX 10000void SortArr(int arr[],int length) { int i = 0, j = 0, k = 0; int int...原创 2019-07-07 08:55:41 · 871 阅读 · 0 评论 -
C++快速排序
C++快速排序#include <iostream>#include <time.h>#include <sys\timeb.h>using namespace std;#define MAX 10000void SortArrar(int arr[],int stack,int end) { int i = stack; int j = end...原创 2019-07-17 21:47:48 · 128 阅读 · 0 评论 -
C++归并排序
C++归并排序#include <iostream>#include <time.h>#include <sys\timeb.h>using namespace std;#define MAX 10000void MergeArray(int arr[], int stack, int end,int mid, int temp[]) { ...原创 2019-07-17 21:49:24 · 111 阅读 · 0 评论 -
C++堆排序
C++堆排序#include <iostream>#include <time.h>#include <sys/timeb.h>using namespace std;#define MAX 10000void SwopArray(int arr[],int x,int y) { int temp = arr[x]; arr[x] = arr[y...原创 2019-07-27 14:31:24 · 171 阅读 · 0 评论 -
C++二叉树
C++二叉树#include <iostream>using namespace std;class TreeNode {public: char str; TreeNode* LeftNode; TreeNode* RightNode; };//遍历输出数节点void PrintTreeNode(TreeNode*node) { if (node==NULL)...原创 2019-07-27 14:33:21 · 614 阅读 · 0 评论 -
C++外观模式
C++外观模式#include <iostream>using namespace std;//外观模式就是将复杂的子类系统抽象到同一个接口进行管理,//外界只需要通过此接口与子类系统进行交互,//而不必要和复杂的子类系统进行交互class Television //电视机类{public: void On(){ cout << "电视机打开" <...原创 2019-06-18 08:28:57 · 259 阅读 · 0 评论 -
C++依赖倒转原则
C++依赖倒转原则#include <iostream>using namespace std;class Business {public: virtual void GeneralService() = 0;};class TransferAccounts :public Business//办理转账业务{public : void GeneralSer...原创 2019-06-09 16:50:01 · 381 阅读 · 1 评论 -
C++工厂方法模式
C++工厂方法模式#include <iostream>#include <fstream>#include <string>using namespace std;void main() { ifstream ifs; ifs.open("main.cpp", ios::in); if (!ifs) { cout << "文件...原创 2019-06-09 16:47:02 · 150 阅读 · 0 评论 -
C++螺纹数组
C++螺纹数组//5x5螺纹void test4(int x) {// 5 4 4 3 3 2 2 1 1:运行次数(for里的第一个for与第二个for) int arr[5][5] = {0};//声明二维数组并初始化(要靠它来判断是否有值) int s=4,y=1,i=0,j=0;//j:第一个循环变量,i:第二个循环变量,y:赋值,s:控制第一个变量的次数 for (in...原创 2019-04-27 12:03:17 · 243 阅读 · 0 评论 -
C++随机数生成QQ号
C++随机数生成QQ号#include <iostream>#include <stdlib.h>#include <time.h>using namespace std;void main() { int num = 0;//QQ位数 int number = 0;//QQ个数 cout << "请输入QQ号的位数" <...原创 2019-05-08 22:13:33 · 1365 阅读 · 0 评论 -
C++巴比伦算法
C++巴比伦算法#include <iostream>using namespace std;void test2();//函数原型void main() { test2();}//用于计算数字n的平方根的巴比伦算法如下://a.先猜一个答案guess(可以将n / 2作为第一个答案)//b.计算r = n / guess//c.令guess = (guess...原创 2019-05-07 10:47:30 · 703 阅读 · 0 评论 -
C++递归斐波那契数列
C++递归斐波那契数列#include <iostream>using namespace std;int Fibonacci(int);//函数原型void main() { int a;cout << "请输入要递归的斐波那契数列的层数" << endl; cin >> a; cout << "----------...原创 2019-05-07 10:49:27 · 3297 阅读 · 1 评论 -
C++单例模式实验多态
C++单例模式实验多态#include <iostream>using namespace std;class Ceshi{public: ~Ceshi(); //static Ceshi* getCeshi(); virtual void printf(); Ceshi*next;protected: Ceshi(); static Ceshi* ceshi...原创 2019-05-16 22:41:43 · 667 阅读 · 0 评论 -
C++单例模式小案例
C++单例模式小案例#include <iostream>using namespace std;class Plural{public: ~Plural(); static Plural*getPort();//获取接口 void getXY();//打印XY void setXY(int, int); friend istream& operator...原创 2019-05-16 22:43:23 · 238 阅读 · 0 评论 -
C++嵌套vector容器
C++嵌套vector容器#include <iostream>#include <vector>using namespace std;class Test{public: Test() {}; Test(int x):x(x) {}; ~Test() {}; vector<int> x;//在类里使用动态数组作为成员变量};void...原创 2019-05-28 07:29:52 · 1760 阅读 · 2 评论 -
C++文件流
C++文件流#include <iostream>#include <fstream>#include <string>using namespace std;void main() { ifstream ifs; ifs.open("main.cpp", ios::in); if (!ifs) { cout << "文件打开失...原创 2019-05-28 07:31:11 · 155 阅读 · 0 评论 -
C++代理模式实现验证登录
C++代理模式实现验证登录 #include <iostream>#include <fstream>#include <string>using namespace std;void main() { ifstream ifs; ifs.open("main.cpp", ios::in); if (!ifs) { cout <<...原创 2019-06-09 16:44:42 · 500 阅读 · 0 评论 -
C++_函数模板+希尔排序
C++_函数模板+希尔排序#include <iostream>#include <time.h>using namespace std;template<class T>void PrintArray(T*arr,int length) { for (int i = 0; i < length; i++) { cout <<...原创 2019-08-17 20:09:34 · 342 阅读 · 0 评论