title: Error "[Error] 'stoi' was not declared in this scope"
body: <p>When I use <code>stoi</code> function in C++ occurs this error:</p>
  
  <blockquote>
    <p>[Error] 'stoi' was not declared in this scope</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/iNMYn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iNMYn.png" alt="enter image description here"></a></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
  
  string nicNo;
  cout &lt;&lt; "Enter your NIC Number"&lt;&lt;endl&lt;&lt;endl;
  cin &gt;&gt; nicNo;
  
  cout &lt;&lt; "Your Birth Year is 19" &lt;&lt;nicNo.substr(0,2 ) &lt;&lt; endl; 
  
  nicNo = nicNo.substr(3, 3);
  cout &lt;&lt; nicNo;
  
  
   int var = stoi(nicNo);
   int day;
  
  if(day&gt;500)
  {
      cout&lt;&lt; "male";`enter code here`
  }
  
  return 0;
  }
  </code></pre>