mytree.h
来自「《Visual C++ Bible》或者说是《Visual C++ 宝典》的对应」· C头文件 代码 · 共 46 行
H
46 行
///////////////////////////////////////////////////////////////////////
//
// Mytree.h - Header file defining the classes that actually do the
// work.
//
// @(#)$Header:$
//
// Description:
// The classes described herein are based on the Tree classes,
// but extend them so that we can do actual work.
//
///////////////////////////////////////////////////////////////////////
class Mytree;
class Mynode : public Node
{
private:
char *key;
char *data;
public:
Mynode()
{ key = NULL; data = NULL; };
Mynode(Mynode & t);
Mynode(char *inkey, char *indata);
~Mynode();
int is_greater(Node *t)
{ return(strcmp(key, ((Mynode *)t)->key) > 0); };
int is_equal(Node *t)
{ return(strcmp(key, ((Mynode *)t)->key) == 0); };
void print();
friend Mytree;
};
class Mytree : public Tree
{
private:
Mynode *insert(Mynode *mnPtr);
Mynode *search(Mynode *mnPtr);
public:
Mynode *insert(char *key, char *data);
Mynode *search(char *key);
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?