Really appreciate it if anyone can helo me out on a C++ problem on tree sorting.
Problem:
Write a sorting algorithm that sorts the individual words in a given article. Using tree sort, list only words of length four or greater, and list a word only once with a notation for the number of times it appears. For example :
alpha
beta(3)
gamma(4)
delta
...
I am using a binary tree and using an inorder search to print out the words
my question is :
1. after loading the file, should I read the words line by line using getline, check it character by character and copy it into a string? Is there a better way?
2. is there any defined function that is able to check whether a character is an alphabet or not? coz' I only want to print out alphabets and not any of the punctuations. The way I did it is that if thre is a non-alphabet word after the last alphabet, then the word ends there.
3. say for example the word "don't", the puctuation will mess things up. How do I do it so that it will still print out the word "don't"
Thanks a lot. I a complete newbie, hope I can get as much advice from more experienced coders.