ECG/exercise1/main.cpp

41 lines
615 B
C++
Raw Normal View History

2019-04-19 12:00:50 +00:00
#include <iostream>
#include "node.h"
2019-05-01 08:44:24 +00:00
int main()
{
2019-04-19 12:00:50 +00:00
/*
Node* root = new Node("root");
Node* left_child = new Node("left child");
Node* right_child = new Node("right child");
root->add_child(left_child);
root->add_child(right_child);
delete root;
*/
2019-05-01 08:44:24 +00:00
/*
Node *auto_root = Node::create_complete_tree(2, 4);
2019-04-19 12:00:50 +00:00
std::cout << auto_root << std::endl;
delete auto_root;
2019-05-01 08:44:24 +00:00
*/
// cycle test
Node *root = new Node;
Node *child1 = new Node;
Node *child2 = new Node;
root->add_child(child1);
root->add_child(child2);
// add cycle
child1->add_child(root);
std::cout << root << std::endl;
2019-04-19 12:00:50 +00:00
return 0;
}