- 博客(10)
- 资源 (11)
- 收藏
- 关注
原创 c++实现万年历,从公元1年1月1日开始,这一天是星期一
//从公元元年一月一日是星期一开始计算//用类实现求万年历的算法#include#include#includeusing namespace std;class Calendar{private: int month; int date; string Day[7];//char Day[7][10];//私有成员不能初始化,而且字符数组要想
2012-10-23 22:18:08 5624 1
原创 c++实现数据结构的二叉树及其遍历二叉树
二叉树的初始化,删除,遍历注意:看是否满足条件,则必须是在调试的对话框的右下侧观察数据是否满足是一个树及其它的左孩子和右孩子//二叉树链式存储的实现#include#includeusing namespace std;struct ECS_data //先定义好一个数据的结构{ char data; ECS_data *l; ECS_data *r;
2012-10-16 12:30:00 2799
原创 建立动态的n维数组
建立一维的动态数组#includeusing namespace std;int main(){ int *p,n,i,n1; cin>>n; p=new int [n]; for(i=0;i<n;i++) { cin>>n1; *(p+i)=n1; } for(i=0;i<n;i++) cout<<*(p+i)<<" "; cout<
2012-10-15 21:35:41 2455 1
原创 用栈实现杨辉三角
//用循环链表实现杨辉三角#include#define Length 10#define ERROR 0#define TRUE 1using namespace std;class XU_DL{private: int *item; int front; int rear; int maxlength;public: XU_DL(int
2012-10-14 21:55:55 2423
原创 栈的实现
//顺序栈的实现/*#include#define STACKlength 100#define ADD 10 #define ERROR 0#define TRUE 1using namespace std;class SX_Stack{private: int *base; int top; int stacklength;public:
2012-10-12 20:42:44 544
原创 循环队列及循环队列实现数值转换
#include#define Length 10#define ERROR 0#define TRUE 1using namespace std;class XU_DL{private: int *item; int front; int rear; int maxlength;public: XU_DL(int length=Length)
2012-10-12 20:41:26 888
原创 特殊矩阵的压缩矩阵及其转置
//已有数据稀疏矩阵的压缩存储及转置/*#include#includeusing namespace std;struct SYZ{ int i,j,v;};struct JZ{ int hang,lie; int n; SYZ *data;};void CSH(JZ &a){ a.hang=4; a.lie=5; a.n=
2012-10-12 20:40:13 1112 1
原创 链表实现(线性,链表)
//顺序线性表 /*#includeusing namespace std;#define Virtuallength 100#define AddspaceList 50#define TRUE 1#define ERROR 0class List{private: int *item; int length; int MAXlength;pu
2012-10-12 20:38:15 633
原创 色子游戏(随机数)
//不用随机数/*#include#include#define TRUE 1#define ERROR 0using namespace std;int Game1() //第一次投掷骰子的方法规则{ int n1,n2; cout cin>>n1>>n2; int s1=n1+n2; if((s1==7)||(s1==11)) return
2012-10-12 20:35:52 974
原创 随机数
//用定义random函数没有直接常量定义(#define random(x)(rand()%x))的好,这样出现相同的概率很大/*#include #include #include using namespace std;int main(){ double random(double,double); srand(unsigned(time(0))
2012-10-12 20:34:15 416
Ncut调试可以运行的程序(matlab)
2016-06-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人