title: Reversing a string in C++ using a reverse iterator?
body: <p>I have the following code and I just can't seem to figure out a way to get the strings reversed here: </p>
  
  <pre><code>stringstream convert;
  string y="";
  string z="";
  convert &lt;&lt; x;
  string::reverse_iterator rit;
  y=convert.str();
  int j=0;
  for (rit = y.rbegin(); rit &lt; y.rend(); rit++){
      z[j] = *rit;
      j++;
  }
  </code></pre>
  
  <p>Can someone help me out with this?  Thanks!</p>