title: Put integer in to string using push_back
body: <p>I am trying to put an integer in to string using the following code:</p>
  
  <pre><code>int x = 42;
  string num;
  bool negative = false;
  
  if(x &lt; 0)
  {
     negative = true;
     x = x * -1;
  }
  while(x &gt; 0)
  {
    num.push_back(x % 10);
    x = x / 10;
  }
  </code></pre>
  
  <p>But when I try to output the string, it comes up with the wired character. Could you please help what's happening in this code??</p>
  
  <p>Edited:
  ps. I want to do this in kind manual way. Means I don't want to use to_string</p>