Comment

Comment by mmaldacker

dictionary is not necessary, the C++ impl just counts the number of words. This can be written as:

  int word_count(const char *const filename)
  {
    std::ifstream file{filename};
    return std::distance(std::istream_iterator<std::string>{file}, {}); 
  }
parent mmaldacker 11 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton