title: c++ converting string to int
body: <pre><code>//sLine is the string
  for(int l = 0; l &lt; sLine.length(); l++)
  {
      string sNumber;
      if(sLine[l] == '-')
      {   
          sNumber.push_back(sLine[l]);
          sNumber.push_back(sLine[l + 1]);
          l++;
      }
      else if(sLine[l] != '\t')
      {
          sNumber.push_back(sLine[l]);
      }
      const char* testing = sNumber.c_str();
      int num = atoi(testing);
      cout &lt;&lt; num;
  }
  </code></pre>
  
  <p>I have this for-loop which checks each character of the string and converts every number in this string to be a int. But for some reason, the atoi function is doing it twice so when I cout it, it displays it twice for some reason... Why is that?</p>
  
  <p>example:
  INPUT
  3   3   -3  9   5<br>
  -8  -2  9   7   1<br>
  -7  8   4   4   -8<br>
  -9  -9  -1  -4  -8</p>
  
  <p>OUTPUT
  3030-309050
  -80-20907010<br>
  -70804040-80<br>
  -90-90-10-40-80</p>