Anonymous user
Word frequency: Difference between revisions
m
Modify C++ alternative to use a named constant to specify how many words to list.
(Modify C++ alternative to ignore case differences, as required by the problem specification.) |
m (Modify C++ alternative to use a named constant to specify how many words to list.) |
||
Line 1,510:
std::map<std::string, int> freq;
std::string line;
const int top = 10;
std::ifstream in("135-0.txt");
Line 1,548 ⟶ 1,549:
"==== ==== =========\n";
int rank = 1;
for (auto iter = pairs.cbegin(); iter != pairs.cend() && rank <=
std::printf("%2d %4s %5d\n", rank++, iter->first.c_str(), iter->second);
}
|