I have to write a c++ program to read html code and do bunch of stuff. One thing that i have to do is to count the no of attributes and sort them in descenting out and print out only first 10 frequently used attributes.
I counted them using maps and sorted them using multimaps but now dnt knw how to print only 10 elements
for(std::map<string, int>::iterator it = Element.begin(); it != Element.end(); ++it)
Elements.insert(pair<int, string>(it->second, it->first));
for(std::multimap<int, string>::reverse_iterator it = Elements.rbegin(); it != Elements.rend(); ++it)
cout << "Element: " << it->second << " : " << it->first << endl;
This is how i did it
an any one please help me display only 10 elements and not all the elements
So I just write this inside the for loop that i have ?
it gives me error on the first line
I am sorry can u please answer me :(
I have my assignment due in couple of hours and its like i am almost there but i am not
i would really really appreciate your help