typedef struct stringnode
{
string value;
stringnode * left;
stringnode * right;
}
I need to create a function that takes as arguments the external pointer to the root node and a "target" string.
The function will then return the number of times the "target" string appears in the tree.
Here is what i have so far. (I know it is basically nothing)
unsigned countstring(stringnode*treepointer,string target)
{
cout<<"What string would you like to search for"<<endl;
cin>>target;
if (treepointer == NULL)
cout<<"Tree is empty!";
else if
{
}
Where I need help is actually navigating through the tree and comparing the target string to the strings stored in the leaf nodes.

New Topic/Question
Reply



MultiQuote






|