- 博客(15)
- 资源 (2)
- 收藏
- 关注
原创 C++实现冒泡排序,插入排序,快速排序,希尔排序,表排序代码
#pragma oncenamespace Sort{ template <typename T> class BigOrder { public: bool operator()(T val1, T val2) { return val1 > val2; } }; template <typename T> class SmallOrder { public: bool operator()(T val1, T val2)
2020-06-03 17:48:17
221
原创 C++根据树的前序遍历,中序遍历写出后序遍历
数据结构(树的遍历)功能实现:根据前序遍历,中序遍历,写出后序遍历。#include <iostream>// 这里就简单写个数组模拟树int preArray[] = { 1,2,3,4,5,6 };int inArray[] = { 3,2,4,1,6,5 };int postArray[6] = { 0 };//根据前序遍历第一个位置,为根节点,中序遍历根节点的左侧为左子树,右侧为右子树,递归分治解决。void createPost(int preL, int inL,
2020-05-28 09:54:27
399
原创 C++用图深度遍历实现坐标是否能到达
数据结构(图像的深度遍历)看浙大老师的数据结构里出了一道题目题目:输入任意坐标,起点和终点,可到达半径,判断起点是否能到达终点。当然广度遍历也可以实现,这里用深度遍历更好些。代码实现全在头文件里,方便看,仅供参考,有什么更好的实现方法欢迎交流。#pragma once#include <math.h>#include <iostream>#include <vector>using std::vector;struct coordinate { i
2020-05-27 16:41:58
275
原创 Windows程序崩溃解决方案
Windows程序意外崩溃解决方案远程调试Remote Debugger生成Dump文件1.远程调试Remote Debugger适用一些特殊机台运行程序崩溃不能在本机进行Debug调试下。优点 清晰,便于开发人员直接找出问题点缺点 限制条件较多环境需求:调试机台。Debug版的运行程式(拷贝到调试机台,包括.pdb等重要调试文件)Remote Debugger(拷贝X86或X64版本到调试机台,视调试机台而定)(举例我的路径在 C:\Program Files (x86)\Mi
2020-05-27 11:08:59
1031
原创 C++模板类实现堆
数据结构堆得实现源代码分享并交流#pragma once#include <vector>#include <iostream>template <typename T>class BigHeapOrder{public: bool operator()(T val1, T val2) { return val1 > val2; }};template <typename T>class SmallHeapOrder
2020-05-27 09:23:20
162
原创 C++求数组中最大子序列问题
在慕课上学习数据结构时看到的C++代码用来解决,借鉴的是浙大老师讲的数据结构,很推荐。第一种是分治思想int Max3(int A, int B, int C){ /* 返回3个整数中的最大值 */ return A > B ? A > C ? A : C : B > C ? B : C;}int DivideAndConquer(int List[], int left, int right){ /* 分治法求List[left]到List[right]的最大子列和 */
2020-05-26 22:35:17
369
原创 C++二分查找的模板方法
C++二分查找的模板方法最近在复习数据结构,看到二分查找写了两个模板,一个传伪函数(伪函数也能写模板比较方便)还有一个是用lambada传参的,当作练习。template <typename T>class more{public: bool operator()(T a, T b) { return a > b; }};//less 举一反三写,用于数组是递减情况template <typename T, typename order>int B
2020-05-26 22:19:06
295
原创 C++栈类小练习
#ifndef VECTOR_H_#define VECTOR_H_#include <iostream>namespace VECTOR{class Vector{public:enum Mode{RECT,POL};private:double x;double y;double mag;double ang;Mode mode;void setMag...
2019-08-27 14:45:15
98
原创 C++类的自动转换(explicit的用法)
#include<iostream>#include<iomanip>class Stonewt{private:enum {LBS_PER_STN = 14};int stone;double pds_left;double pounds;public:explicit Stonewt(double lbs);/*Stonewt(int stn, d...
2019-08-27 14:45:02
88
原创 Clock_t类的使用
#include<stdio.h>#include <iostream>#include<stdlib.h>#include<Windows.h>#include<ctime>#include<iso646.h>void main(){using namespace std;/*float sec;cin ...
2019-08-27 14:43:49
230
原创 Unzip解压zip压缩包
Unzip解压zip压缩包ZLib库工作中遇到需要从原来解压rar(用的unrar库)改成解压zip的需求,刚开始度娘了网上有zlib库,所以尝试用该库开发,网上有很多一个很火的case,但是到了 //读取文件 const int BUFFER_SIZE = 4096; char szReadBuffer[BUFFER_SIZ...
2019-08-27 14:32:59
740
原创 C语言的单链表基本操作
#ifndef HEAD_MENU_H#define HEAD_MENU_H#include"linknode.h"#include <time.h>#include <stdlib.h>#include <conio.h>#include <Windows.h>void Initialize(linknode *a,int n);void Outp...
2018-05-15 15:00:02
219
原创 C++对数组的基本操作
#include<stdio.h>#include<cstdlib>#include<conio.h>#include <iostream>#include<fstream>#include<stdlib.h>#include<Windows.h>#include<ctime>#incl
2018-05-15 14:57:32
2732
原创 C++定时器
#include<stdio.h>#include <iostream>#include<stdlib.h>#include<Windows.h>#include<ctime>void main(){ using namespace std; float sec; cin >> sec; clock_t delay = sec...
2018-05-14 15:52:49
399
原创 C语言文件的简单写入和读出
#include <stdio.h>#include <stdlib.h>#include <conio.h>#include <string.h>#include <time.h>#define PI 3.14159#define s(r) PI*(r)*(r)typedef struct{char english[...
2018-05-12 15:33:10
1257
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人