https://github.com/l-paz91/principles-practice/tree/master/Graphics%20Files
Chapter 14 // Exercise 14
Add an operation to Binary_tree that adds text to a node. You may have to modify the design of Binary_tree to implement this elegantly. Choose a way to identify a node; for example, you might give a string "lrrlr" for navigating left, right, right, left, and right down a binary tree (the root node would match both an initial l and r.
Github: https://github.com/l-paz91/principles-practice/tree/master/Chapter%2014/Exercise%2014
Thankfully, because I store all the nodes in a vector in order, I can simply have the user enter a number to identify what node they want. I'm very happy about this because the left right stuff sounds tedious as fuck.
The only problem is that our programs do not have a message loop (you need to press next), so capturing data from the user is a no. This means, the programmer needs to know how many nodes there will be to know exactly which one to select and add text to. It's not great but it will do for now. The text also resizes itself based on how big the tree size is.
The only problem is that our programs do not have a message loop (you need to press next), so capturing data from the user is a no. This means, the programmer needs to know how many nodes there will be to know exactly which one to select and add text to. It's not great but it will do for now. The text also resizes itself based on how big the tree size is.
No comments:
Post a Comment