title: How to erase characters in a string?
body: <p>I've got problem with erase function from string. I can't remove a single character from certain index. 
  Maybe I can't use int "i" as iterator ? I want to remove some characters.</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void deleteChars(string inputText, string inputChars);
  
  int main(int argc, char *argv[])
  {
      string tekst1 = ("mama fama lilo babo sabo");
      string tekst2 = ("mabo");
  
      deleteChars(tekst1, tekst2);
  
      system("PAUSE");
      return EXIT_SUCCESS;
  }
  
  void deleteChars(string inputText, string inputChars){
            int a = inputText.size();
            int b = inputChars.size();
  
            string tmp = inputText;
  
            for(int i=0; i&lt;a; i++){
                    for(int j=0; j&lt;b; j++){
                            if(inputText.at(i)==inputChars.at(j)){
                                tmp.erase(i,1);  //Here is my problem ?
                             }                                    
                    }
            }
  
            inputText = tmp;
  
            cout&lt;&lt;"text: "&lt;&lt;inputText&lt;&lt;endl;
  
  }
  </code></pre>
  
  <p>My error:</p>
  
  <pre><code>This application has requested the Runtime to terminate it in an unusual way
  </code></pre>