All pastes #271496 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-08 07:13 UTC
rendered paste body
class Node
{
 private:
  char type;   // type of data. "A" is an answer node. "Q" is a question node.
  string data; // actual node data
  int id;      // used for writting to file

 public:
  Node* yes;                    // pointer to "yes" node
  Node* no;                     // pointer to "no" node
  Node* parent;                 // pointer to it's parent;
  string get_data();            // gets the node data
  void set_data(char my_type, string data, Node* parent);     // sets the node data
  void set_only_data(string my_data);
  void set_type(char);          // sets the type of node
  char get_type();              // gets the type of node
  int get_id();                 // get the id of the node
  int set_id(int new_id);       // sets an ID
  
  Node();
  //Node(string data, char type);

};

class Tree
{
   private:
	char type;        //type of data. "A" is an answer, "Q" is a question
	string data;      //actual data of node
	int node_count;   //count of nodes currently being used

   public:
	Tree();
	~Tree();
	Node* head;       //first node
	Node* current;    //pointer to the current node
	void add_node(char type, string data, Node* parent, char y_or_n);
	void display_list(Node* node);
	void display_list_left(Node* node);
	void display_list_right(Node* node);
	int get_id(Node* node);
	string get_node_data();
	int save_data(Node* head);
	void write_data(ofstream& ostrFile,Node* node);
	void load_data(Node* node);
};

//in main.cc
head->set_id( id );