title: C++ - assign Vector value to std::string without losing data
body: <p>I want to assign the value of a int vector to a std::string in order to pass it to another function, for now i wrote this code:</p>
  
  <pre><code>int input;
  std::cout &lt;&lt; "Insert the value to convert: \t";
  std::cin &gt;&gt; input;
  std::string output;
  
  std::vector&lt;int&gt; rem;
  
  int r; //Just a simple binary conversion
  while(input != 0) {
      r = input % 2;
      rem.push_back(r);
      input /= 2;
  }
  std::reverse(rem.begin(), rem.end());
  for(std::vector&lt;int&gt;::const_iterator it = rem.begin(); it != rem.end(); ++it) {
      output += *it; //Assign every value of the iterator to string variable
  
  }
  std::cout &lt;&lt; output; Print the value of output
  </code></pre>
  
  <p>The problem with my code is that the string contains weird characters like <code>☺  ☺☺☺ ☺☺☺☺  ☺</code>...is there any way to prevent that?</p>