1

When I use stoi function in C++ occurs this error:

[Error] 'stoi' was not declared in this scope

enter image description here

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;

int main()
{

string nicNo;
cout << "Enter your NIC Number"<<endl<<endl;
cin >> nicNo;

cout << "Your Birth Year is 19" <<nicNo.substr(0,2 ) << endl; 

nicNo = nicNo.substr(3, 3);
cout << nicNo;


 int var = stoi(nicNo);
 int day;

if(day>500)
{
    cout<< "male";`enter code here`
}

return 0;
}
cbuchart
  • 10,847
  • 9
  • 53
  • 93
Jeewantha
  • 13
  • 4
  • 2
    The [stoi function](http://en.cppreference.com/w/cpp/string/basic_string/stol) was added in C++11. Did you ask your compiler to use that language version? Otherwise it might default to C++98. – Bo Persson Nov 10 '17 at 13:30
  • i m using devc++ 5.11 tell me me how i solve it – Jeewantha Nov 10 '17 at 13:38
  • Check this answer to do so: https://stackoverflow.com/a/16951613/1485885 – cbuchart Nov 10 '17 at 14:00
  • Possible duplicate of [How to change mode from c++98 mode in Dev-C++ to a mode that supports C++0x (range based for)?](https://stackoverflow.com/questions/16951376/how-to-change-mode-from-c98-mode-in-dev-c-to-a-mode-that-supports-c0x-ran) – underscore_d Nov 10 '17 at 14:03

0 Answers0