ECG/exercise1/main.cpp

41 lines
615 B
C++

#include <iostream>
#include "node.h"
int main()
{
/*
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;
*/
/*
Node *auto_root = Node::create_complete_tree(2, 4);
std::cout << auto_root << std::endl;
delete auto_root;
*/
// 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;
return 0;
}