title: 'Replace' a char with an int in a string
body: <p>At first this seemed easy to do but I was mistaken. <strong>I want to 'replace' a char (a variable) in a string with a int (value). But how?</strong></p>
  
  <p>I tried replace() because I'm working with a string and it worked but it will not work if I wish to change the value of the variable again to another
  value  because then the original variable will not be found. I have been struggling with this for the passed 2 days. Any help will be much appreciated on how to do this.</p>
  
  <pre><code>changeVar(string startingExpr, char var, int val)
  {
      for(int i = 0; i &lt; startingExpr.length(); i++)
      {
          if(startingExpr[i] == var)
          {
              cout &lt;&lt; "I found x! Now to replace it!";
              startingExpr[i] = val;       //'Replace' x with 5, but x but how?
          }
      }
  }
  </code></pre>
  
  <p>Your help on this one will be much appreciated.</p>
  
  <p>J</p>