Cannot convert from string to int using stoi
<p>In my program first I read a file into a vector of strings called <code>rosterList</code>:</p>

<blockquote>
  <p>100 </p>
  
  <p>95 </p>
  
  <p>0</p>
  
  <p>-1</p>
  
  <p>110 </p>
  
  <p>80 </p>
  
  <p>90</p>
  
  <p>-1</p>
  
  <p>120 </p>
  
  <p>80 </p>
  
  <p>75</p>
  
  <p>-1</p>
  
  <p>130 </p>
  
  <p>60 </p>
  
  <p>55</p>
  
  <p>-1</p>
</blockquote>

<p>This step is successful. My goal is to create a vector of <code>Student</code> objects using the data above. Constructor accepts 3 strings as parameters:</p>

<pre><code>Student::Student(string id,string g1,string g2)
</code></pre>

<p>To do that, the program loops through this vector of strings line by line, if the line converted to integer is greater or equal to 100, it is an id, then dynamically create a new <code>Student</code> object by passing the id (current line) and the next 2 lines as parameters, and add the object to the vector <code>studentRecords</code></p>

<pre><code>for (vector&lt;string&gt;::iterator it = rosterList.begin(); it&lt;rosterList.end();it++){
        if(stoi(*it)&gt;=100 || it == rosterList.begin()){ // error
            studentRecords.push_back(
                 Student(*it,*(it+1),*(it+2)) // dynamically push 
            );
        }
    }
</code></pre>

<p>And there is a dynamic error: </p>

<blockquote>
  <p>libc++abi.dylib: terminating with uncaught exception of type
  std::invalid_argument: stoi: no conversion</p>
</blockquote>

<p>I looked it up online, the error comes from <code>stoi</code> not be able to convert. Where in the program goes wrong?</p>