怎么将string转换为int 方法一、使用自带的stoi()函数 #include <iostream> #include <string> using namespace std; int main() { string str="123";