Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T>
- void Tree<T>::CreateTree(int i, int parentIndex)
- {
- if (i >= size)
- {
- return;
- }
- Node<T> el;
- T x; char ch;
- std::cout << "root: " << i << " " << std::endl;
- std::cin >> x;
- el.root = x;
- el.position = parentIndex;
- p[i] = el;
- std::cout << "left BinTree of: " << x << " y/n? ";
- std::cin >> ch;
- if (ch == 'y')
- {
- CreateTree(2 * i + 1, i);
- }
- std::cout << "right BinTree of: " << x << " y/n? ";
- std::cin >> ch;
- if (ch == 'y')
- {
- CreateTree(2 * i + 2, i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement