c++lexicon

I am trying to create a lexicon using an input file in C++


I have a file.txt I want to create a function in C++ that can read the words in that file, and print each word and how many times they occur into a file2.txt

I am doing some research I know i can use the parser and writer, and also the map class, any help please?

bool Parser::hasMoreTokens() {
  if(source.peek()!=NULL){
    return true;
}
else{
     return false;
}
}

Solution

  • Is this home work? Look online for std::map, std:string, std::ifstream and std::ofstream.