I did go to this far. I wanna implement istream and ostream to bintree but hvn't known yet.
This is the code by far i have recognized the duplicate word in the tree. I wanna the istream and ostream to put the count for duplicate word.
1 more trouble is few last word of the file didn't display on the screen and tree.
In some book and template. ostream related to bintree by defined
ostream &operator>> (ostream &os, bintree<words> word);
i did try but it cannot work.
Code:
words w(new_word); //for ostream i have to use this word class. It not related to bintree
//should i define bintree<words> s in class words instead of string s.
if (isspace(*itr) || *itr == '>' || *itr == '<' || *itr == '!' || *itr == ',')
{
if (word.find(new_word))
{
i++;
new_word.clear();
}
else
{
word.insert(words(new_word));
cout << w; //using ostream to display the output
new_word.clear(); // Empty the string
}
}
else
{
new_word += *itr;
}
itr++;
and text file
Code:
Today!is-not-a-good-day, the<problem<is<this "<"
More.about.decimal 0.2abc 0.2 .2abc .2 abc.2abc abc.2 abc0.20 .2 . 2
This is the quote "I don't know this will work".
EOF
the display shown up till "will" then finish.
thx and regard