我正在测试std::stoi
以下链接中的函数:
但我收到了错误:
已经添加了头文件#include<string>,但仍然错误提示:在命名空间 std 中没有名为 stoi 的成员;
这可能是VS Code 在C++11方面的问题 有资料说是VS Code本身的BUG
#include <iostream>
#include <string>
int main() {
std::string test = "45";
int myint = std::stoi(test);
std::cout << myint << '\n';
}
修改:
采用atoi()函数来实现:int myint=std::atoi(test.c_str())
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)