title: print map values in descending order in c++
body: <p>I have a map input which contains a list of words and their counts.</p>
  
  <p>I use this function to print the <code>map</code> input:</p>
  
  <pre><code>template &lt;class KTy, class Ty&gt;
  void PrintMap(map&lt;KTy, Ty&gt; map)
  {
      typedef std::map&lt;KTy, Ty&gt;::iterator iterator;
      for (iterator p = map.begin(); p != map.end(); p++)
          cout &lt;&lt; p-&gt;first &lt;&lt; ": " &lt;&lt; p-&gt;second &lt;&lt; endl;
  }
  </code></pre>
  
  <p>it prints the values likes this:
  <code>
  you : 296
  she : 14
  go : 29
  </code></p>
  
  <p>how can I print it in descending order of word count.</p>