0

我在Windows 10上使用Code::Blocks 16.01

我需要将字符串转换为整数。

所以我正在尝试使用stoi,但它说它没有声明。

-std=c++11在编译器设置中启用了,但它仍然给我一个错误:

'stoi' was not declared in this scope

代码::块的屏幕截图:

代码::块的屏幕截图

导致错误的代码部分是:

#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);
    }
}
4

0 回答 0