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.