I am trying to writing a C++ code that will count the words from a text file.
I want the code to output the top 5 most and least most frequent words and how many times it appears.
This the code i have stared on and i keep getting an error saying
Error 1 error C2872: 'count' : ambiguous symbol
why?
- On which line are you getting the error?
- Also, why are you using an array to count the instances of match.
You can just use an integer variable and increment its value every time a matching word is found.
Usually if the compiler complains about an ambiguous symbol it will point you at the two symbols which are colliding. One is your global variable. The other might be std::count(), which you're bring into the global namespace as you're using usingnamespace std; http://www.cplusplus.com/reference/algorithm/count/
But as I said, I don't get the error.
Which version of Visual Studio are you using? (Going by the error code C2872 I guess it's Visual Studio you're using?)