0

Hi, all
I am the STL beginner and also kind of new in c++.
And i got one assignment about write the text utility class with pieces of STL.

So the following two function implement totally freak me out.
wordlengths() finds and returns the number of words of different lengths in the file of text.

//intpairvector is the vector<pair <int,int > > type
IntPairVector TextUtil::wordLengths() const
{
    string word; 
	TextUtil test;
	while ( file >> word )
  {
     for ( int i = 0; i < word.length(); i++ )
      {
         //judge weather the word inside the file have punctuations  
            if(test.isPunctuation(word[i]) == true)
		//here is something i don't know how to write?? 
		  
	  }
  }
}

//topnwords find the most frequent appear word in the file.

//stringintvector is the vector< pair < string, int > > type
StringIntVector TextUtil::topNWords(size_t n) const
{
  //also don't know how to implement it.
}

Well, i know the Daniweb is not help with writing code.
But is there any similar post i could look for??
Or specify reference i could find??

Any suggestion or help will be appreciated.
And many thanks.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by orwell84
0

Daniweb is pretty good with helping people write code, actually. You just need to do some work. Anyway, I don't know if this will help a ton, but here's an article on STL

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.