Do you need to write it in C++?
What do you want to use it for?
A basic approach would be to split the text up, delimited by spaces, put it into an array. Maybe everything in lowercase letters. Then you just take the next word, see if it is already in the array and if not append it.
Might not be the fastest way but I don't have time to think about time optimized algorithms right now.