c++ - Attempting to read in a string to put into a binary tree -


I am trying to get a string and then trying to manipulate it in a binary tree. The only problem is, I have really been having difficult time reading strings. I know that every person character in C ++ is a four letter, not a string, but I can not understand how to get each variable through Strong to be rearranged. Trying to install the constructor and then going to my build tree function which will continue the line again. Anyone have any ideas?

  class prefix {personal: struct treenode {character; TreeNode * left; Tree node * Correct; }; TriNode * Root = New Treeode; Public: Prefix (string value) {if (value == '*') {root-> character = value; } Buildty (root, value); } TreeNode * Build Tree (TreeNode * Node, String value) {TriNode * moves = new triode; CurrentNode = node; If (currentNode-> character == '*' and & currentNode-> left == tap) {currentNode-> left = buildtree (currentNode-> true, value); Return CurrentNode; } Else if (currentNode-> character == '*' and & currentNode-> right == tap) {currentNode-> right = buildTree (currentNode-> right, value); Return CurrentNode; } And {returnNot; }}  

And how am I calling the constructor in the main:

  prefecture n ("* ab");  

You can use the [] operator on the string to get the individual letters .

For example:

  string a = "hello"; Cout & lt; & Lt; A [0];  

The print will be the first letter of "A".

I suggest getting a character with the operator [] within my recurring function, then using the .substr () function to recurs in the part of the string.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -