**使用之前要包含头文件#include< string >stoi()会对参数字符串进行范围判断,默认范围是在int的范围内[-2147483648, 2147483647]的,如果超出范围的话则会runtime error.
#include#include using namespace std; int main() { string str = "111111"; int a = stoi(str); cout << a << endl;//输出111111 return 0; }

**使用之前要包含头文件#include< string >stoi()会对参数字符串进行范围判断,默认范围是在int的范围内[-2147483648, 2147483647]的,如果超出范围的话则会runtime error.
#include#include using namespace std; int main() { string str = "111111"; int a = stoi(str); cout << a << endl;//输出111111 return 0; }