Hello, If I have a file that has a bunch of words in it and some of those words are repeated, how do you grab the first word and then check it with all the other words to see if it is the same. This is what I have so far which is only grabbing the first word twice, saying it is the same obviously, and outputing it.
The std::map is usually what you'll want. It will accept a string as a key, which will be the word that you read in. If the string doesn't exist, then it gets created automatically. Otherwise, the duplicate word that you read in will overwrite the old (which doesn't really matter, since the values are identical anyway).
Notice that this will not necessarily print out the resulting words in the same order in which they were read in, although that can be left up as an exercise you can implement.