This function reads a text file and shows how many times a words appears in the text file, how do I save it to a different text file after running this function?
std::ifstream f("test.txt");
std::istream_iterator<std::string> eof;
std::multiset<std::string> words( std::istream_iterator<std::string>(f) , eof);
for( std::multiset<std::string>::iterator i = words.begin(); i!=words.end(); i = words.upper_bound(*i) )
std::cout << *i<< ": " << words.count(*i) << " times\n";