自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 资源 (1)
  • 收藏
  • 关注

原创 数据结构之插入排序

#include <iostream>using namespace std;void insertSort(int r[],int n){    int i,j;    for(i=2;i<n;i++)    {        if(r[i]<r[i-1])        {             r[0]=r[i];   //复制为哨兵            for(...

2018-06-30 11:44:10 286

原创 数据结构之选择排序

#include <iostream>using namespace std;void selectSort(int a[],int n){ for(int i=0;i<n;i++) { int k=i; for(int j=i+1;j<n;j++) { if(a[j] < a[k]) k=j; } if(k!=i) swap(a[k],a[i...

2018-06-30 11:29:55 274

原创 数据结构之冒泡排序

#include <iostream>using namespace std;void bubbleSort(int r[],int n){ for(int i=1;i<n-1;i++) { for(int j=1;j<n-i;j++) { if(r[j] > r[j+1]) swap(r[j],r[j+1]); } }}int main(){ int...

2018-06-30 11:22:29 317

原创 C++之重载矩阵相加

#include <iostream>using namespace std;class Matrix{ public: Matrix(); friend Matrix operator +(Matrix &,Matrix &); void input(); void display(); private: int mat[2][3]; };Matrix:...

2018-06-22 09:49:18 1695

原创 数据结构之采用邻接矩阵创建网,实现求双源最短路径的Floyd算法

#include <iostream>#include <iomanip>using namespace std;const int INF=99;const int n=4;int D[n][n]={  0,  1,INF,  4,        //Floyd算法的邻接矩阵,主对角线元素为0             INF,  0,  9,  2,           ...

2018-06-18 13:14:12 375

原创 数据结构之采用邻接矩阵创建网,实现求单源最短路径的Dijkstra算法

#include <iostream>using namespace std;const int INF=9999;const int n=6;  //顶点数int G[n][n]={INF,INF, 10,INF, 30,100,             INF,INF,  5,INF,INF,INF,             INF,INF,INF, 50,INF,INF,    ...

2018-06-18 13:13:11 509

原创 数据结构之实现Kruskal算法,求连通图的最小生成树

#include <iostream>#include <algorithm>using namespace std;const int INF=99;const int n=6;  //顶点数int G[n][n]={INF,  6,  1,  5,INF,INF,               6,INF,  5,INF,  3,INF,               1,...

2018-06-14 20:09:58 940

原创 数据结构之实现Prim算法,求连通图的最小生成树

#include <iostream>using namespace std;const int INF=99;const int n=6; //顶点数 int G[n][n]={INF,  6,  1,  5,INF,INF,               6,INF,  5,INF,  3,INF,               1,  5,INF,  5,  6,  4,      ...

2018-06-14 20:06:59 2275

原创 数据结构之基于图的广度优先搜索,判断无向图的连通性

#include <iostream>using namespace std;struct LinkNode{ int data; LinkNode *next;};struct LinkQueue{ LinkNode *front; LinkNode *rear;};void init(LinkQueue *&Q){ Q=new LinkQueue; Q->front=...

2018-06-09 16:59:04 1201

原创 数据结构之实现无向图的广度优先搜索算法

#include <iostream>using namespace std;struct LinkNode{ int data; LinkNode *next;};struct LinkQueue{ LinkNode *front; LinkNode *rear;};void init(LinkQueue *&Q){ Q=new LinkQueue; Q->front=...

2018-06-09 16:52:44 701

原创 C++之重载流提取运算符

#include <iostream>using namespace std;class Complex { public: Complex() { real=0; imag=0; } Complex(double r,double i):real(r),imag(i){} friend istream & operator >>(istream ...

2018-06-08 10:10:33 1223

原创 C++之重载流插入运算符

#include <iostream>using namespace std;class Complex { public: Complex() { real=0; imag=0; } Complex(double r,double i):real(r),imag(i){} Complex operator +(Complex &); friend ostr...

2018-06-08 09:52:02 668

原创 C++之纯虚函数与抽象类

#include <iostream>using namespace std;class Shape{ public: virtual double area() const=0; };class Circle:public Shape //圆形 { public: Circle(double r):radius(r){} double area() const { ...

2018-06-08 09:27:42 187

原创 数据结构之基于深度优先搜索,输出无向图中给定的两个顶点之间的所有路径

#include <iostream>using namespace std;struct StackNode{ int data; StackNode *next;};void push(StackNode *&S,int e){ StackNode *p=new StackNode; p->data=e; p->next=S; S=p;}int pop(Stac...

2018-06-03 15:29:43 4131

原创 数据结构之实现图的深度优先搜索算法

#include <iostream>using namespace std;int G[10][10]={ {0,1,0,1,0},        {1,0,1,0,1},              {0,1,0,1,1},        {1,0,1,0,0},        {0,1,1,0,0}, }; int vexnum=5;int visited[5]...

2018-06-03 15:02:42 658

原创 C++之无向图3

#include <iostream>using namespace std;int G[10][10]={ {0,1,0,1,0},        {1,0,1,0,1},        {0,1,0,1,1},        {1,0,1,0,0},        {0,1,1,0,0}, };int vexnum=5;void show(){ for(int ...

2018-06-02 20:51:59 326

原创 C++之重载单目运算符2

#include <iostream>using namespace std;class Time{ public: Time() { minute=0; sec=0; } Time(int m,int s) { minute=m; sec=s; } Time operator ++ (); //声明前置自增运算符"++"重载函数  Time oper...

2018-06-02 16:22:20 292

原创 C++之重载单目运算符1

#include <iostream>using namespace std;class Time{ public: Time() { minute=0; sec=0; } Time(int m,int s) { minute=m; sec=s; } Time operator ++ (); void display() { cout<&lt...

2018-06-02 16:02:28 1922

原创 C++之运算符重载函数作为友元函数

#include <iostream>using namespace std;class Complex{ public: Complex() { real=0; imag=0; } Complex(double r,double i) { real=r; imag=i; } friend Complex operator + (Complex &...

2018-06-02 15:46:00 966

原创 C++之运算符的重载

#include <iostream>using namespace std;class Complex{ public: Complex() { real=0; imag=0; } Complex(double r,double i) { real=r; imag=i; } Complex operator + (Complex &c2); v...

2018-06-01 22:31:04 119

原创 C++之静态成员函数2

#include <iostream>using namespace std;class Student{ public: Student(int n,double s):num(n),score(s){} static double average(Student *,int); static void MaxScore(Student *,int); private: in...

2018-05-31 16:23:03 195

原创 C++之静态成员函数

#include <iostream>using namespace std;class Student{ public: Student(int n,int a,double s):num(n),age(a),score(s){} static double average(Student *stud,int); private: int num; int age; dou...

2018-05-31 15:59:19 127

原创 数据结构:无向图2

#include <iostream>using namespace std;int G[10][10]={ {0,1,0,1,0}, {1,0,1,0,1}, {0,1,0,1,1}, {1,0,1,0,0}, {0,1,1,0,0}, };int vexnum=5;void show(){ for(int i=0;i<vexnum;i++) { fo...

2018-05-30 13:26:59 263

原创 数据结构:无向图1

#include <iostream>using namespace std;int G[10][10]={ {0,1,0,1,0}, {1,0,1,0,1}, {0,1,0,1,1}, {1,0,1,0,0}, {0,1,1,0,0}, };int vexnum=5;void show(){ for(int i=0;i<vexnum;i++) { fo...

2018-05-30 12:27:13 737

原创 C++之虚基类

#include <iostream>using namespace std;class Person{ public: Person(string nam,string s,int a):name(nam),sex(s),age(a){} protected: string name; string sex; int age;};class Teacher:virtual p...

2018-05-30 11:23:27 139

原创 C++之多重继承派生类的构造函数

#include <iostream>using namespace std;class Teacher{ public: Teacher(string nam,int a,string t):name(nam),age(a),title(t){} void display() { cout<<"name:"<<name<<endl; ...

2018-05-30 11:01:19 1689 1

原创 C++之 友元成员函数

#include <iostream>using namespace std;class Date;class Time{ public: Time(int,int,int); void display(Date &); private: int hour; int minute; int sec;};class Date{ public: Date(int,int...

2018-05-25 10:09:02 389

原创 C++之将普通函数声明为友元函数

#include <iostream>using namespace std;class Time{ public: Time(int,int,int); friend void display(Time &); private: int hour; int minute; int sec;};Time::Time(int h,int m,int s){ hour=h...

2018-05-25 09:44:17 1363

原创 建立二叉排序树,并实现插入、查找等操作

#include <iostream>using namespace std;struct BSTNode{    int data;    BSTNode *lchild;    BSTNode *rchild;};void insertBST(BSTNode *&T,int e){ if(T) { if(e < T->data) insertBST(T-&...

2018-05-24 20:02:13 2895

原创 数据结构之判断给定的一棵二叉树是否是完全二叉树

#include <iostream>using namespace std;struct BitNode { char data; BitNode *lchild; BitNode *rchild;};struct LinkNode{ BitNode *data; LinkNode *next;};struct LinkQueue{ LinkNode *front; LinkNode...

2018-05-24 19:26:35 3149

原创 数据结构之判断两棵二叉树是否相等

#include <iostream>using namespace std;struct BitNode  {     char     data;     BitNode *lchild;    BitNode *rchild; };    void create(BitNode *&T) {  char ch; cin>>ch; if(ch=='#') T=N...

2018-05-20 15:34:18 7651 4

原创 C语言之多层派生时的构造函数

#include <iostream>using namespace std;class Student{ public: Student(int n,string nam) { num=n; name=nam; } void display1() { cout<<"num:"<<num<<endl; cout<&lt...

2018-05-19 16:27:02 403

原创 C语言之含有子对象的派生类的构造函数

#include <iostream>using namespace std;class Student{ public: Student(int n,string nam) { num=n; name=nam; } void display1() { cout<<"num:"<<num<<endl; cout<&lt...

2018-05-19 16:06:58 498

原创 C语言之派生类的析构函数

#include <iostream>using namespace std;class Student{ public: Student(int n,string nam) { num=n; name=nam; } ~Student() { cout<<"D."<<num<<endl; } protected: int n...

2018-05-19 15:57:45 789

原创 C语言之简单的派生类的构造函数

#include <iostream>using namespace std;class Student{ public: Student(int n,string nam) { num=n; name=nam; } protected: int num; string name;};class Student1:public Student{ public: St...

2018-05-19 15:54:01 575

原创 C语言之公用继承2

#include <iostream>using namespace std;class Student{ protected: int num; string name;};class Student1:public Student{ public: void get2() { cin>>num>>name>>sex>>sc...

2018-05-19 15:48:23 97

原创 C语言之公用继承1

#include <iostream>using namespace std;class Student{ public: void get1() { cin>>num>>name; } void display1() { cout<<"num:"<<num<<endl; cout<&a

2018-05-19 15:45:39 120

原创 数据结构之层序遍历二叉树

#include <iostream>using namespace std;struct BitNode { char data; BitNode *lchild; BitNode *rchild;};struct LinkNode { BitNode *data; LinkNode *next;};struct LinkQueue{ LinkNode *front; LinkNod...

2018-05-17 19:40:43 392

原创 数据结构之复制二叉树

#include <iostream>using namespace std;struct BitNode{ char data; BitNode *lchild; BitNode *rchild;};void create(BitNode *&T){ char ch; cin>>ch; if(ch=='#') T=NULL; else { T=new BitN...

2018-05-16 21:16:08 1797

原创 C++之静态数据成员

#include <iostream>using namespace std;struct Box{ public: Box(int,int); Box(int,int,int); int volume(); void show() { cout<<"height="<<height<<endl; } private: ...

2018-05-16 12:00:11 151

Python实现字典.zip

用Python实现简单的字典,建立初始化的英文单词字典内容,每个单词要有对应的中文解释,实现字典的增加(可以通过程序实现单词及中文解释添加)、删除(通过程序实现单词的删除)、查找(通过程序实现单词的查找,要有单词联想功能

2019-06-30

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除