title: sort in lexicographic order in map C++
body: <p>I am using STL map in C++ for counting the frequency of words in a text file and words must be sort in lexicographic order. Input data is given as a text file. Ive already read and added them in map but i got a problem with sorting.</p>
  
  <p>Example, i have { "Abc", "abc", "bag", "Boom", "great"}. When i added them in map, i got</p>
  
  <blockquote>
    <p>Abc 1 Boom 1 abc 1 bag 1 great 1</p>
  </blockquote>
  
  <p>but expected result is</p>
  
  <blockquote>
    <p>Abc 1 abc 1 Boom 1 bag 1 great 1</p>
  </blockquote>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;map&gt;
  #include &lt;fstream&gt;
  using namespace std;
  typedef map&lt;string, int&gt; word_count;
  
  int main(){
      word_count wc;
      fstream f_in;
      f_in.open("test.in");
      string x;
  
      while( !f_in.eof()){
          f_in &gt;&gt; x;
          wc[x]++;
      }
      f_in.close();   
      return 0;
  }
  </code></pre>
  
  <p>Here is my code for reading input. Any help for my problem? Thanks</p>