title: C++ string to int without using atoi() or stoi()
body: <p>Hi I am new to C++ and trying to do an assignment where we read a lot of data from a txt file in the format of</p>
  
  <pre><code> surname,initial,number1,number2
  </code></pre>
  
  <p>I asked for help before an someone suggested reading the 2 values as string then use stoi() or atoi() to convert to int. This works great, except I need to use this parameter "-std=c++11" for compiling or it will return an error. This is not a problem on my own computer which will handle "-std=c++11", but unfortunately for me the machines which I have to present my program on does not have this option.</p>
  
  <p>If there another way which I can convert string to int that doesn't use stoi or atoi?</p>
  
  <p>Here is my code so far.</p>
  
  <pre><code>while (getline(inputFile, line))
  {
      stringstream linestream(line);
  
      getline(linestream, Surname, ',');
      getline(linestream, Initial, ',');
      getline(linestream, strnum1, ',');
      getline(linestream, strnum2, ',');
      number1 = stoi(strnum1);
      number2 = stoi(strnum2);
  
      dosomethingwith(Surname, Initial, number1, number2);
  }
  </code></pre>