title: String reverse, std::string does not allow character assignment?
body: <p>This is my code to reverse a string using <code>std::string</code>. But it does not work..</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  main()
  {
     string input;
     int i, j;
     cout &lt;&lt; "Enter a string: ";
     getline(cin,input);
  
     string output;
     for(i = 0, j = input.length() - 1; i &lt; input.length(); i++, j--)
        output[i]=input[j];
  
     cout &lt;&lt; "Reversed string = " &lt;&lt; output;
     cin.get();
  }
  </code></pre>
  
  <p>But if we replace string output as <code>char output[100];</code> it works. So <code>std::string</code> does not allow character assignments?</p>