I'm using Code::Blocks 16.01 on Windows 10.
I need to convert a string to an integer.
So I'm trying to use stoi
, but it says it's not declared.
I have enabled -std=c++11
in compiler settings but it still gives me an error:
'stoi' was not declared in this scope
Screenshot of Code::Blocks:
The part of the code which causes the error is:
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
int main() {
int n,m,k;
string nmk;
ifstream test("input00.txt");
if (test.is_open())
{
getline (test,nmk,' ');
n = stoi (nmk,NULL,10);
getline (test,nmk,' ');
m = stoi (nmk,NULL,10);
getline (test,nmk, '\n');
k = stoi (nmk,NULL,10);
}
}