当前位置:   article > 正文

C++ class实现孩子表示法_定义类结构用孩子表示法

定义类结构用孩子表示法

在这里插入图片描述
代码如下:

#include <iostream>
using namespace std;
typedef char ElemType;
const int MAXSIZE = 100;

class link
{
	friend class Node;
private:
	int child;
	link *next;
};

class Node
{
	friend class Tree;
private:
	ElemType data;
	link *first;
};

class Tree
{
private:
	int n;
	Node elem[MAXSIZE];
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/1014335
推荐阅读
相关标签
  

闽ICP备14008679号