1、string 转 int 用stoi函数
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
string s="123";
cout<<stoi(s)<<endl;
return 0;
}
2、int 转 string 用 to_string 函数
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int s=123;
cout<<to_string(s)<<endl;
return 0;
}