数字类型转为string字符串
to_string(num);
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 123456;
string str = to_string(n);
cout << str;
return 0;
}
string字符串转为数字类型
stoi(int),stol(long), stof(float), stod(double)
#include<bits/stdc++.h>
using namespace std;
int main(){
string str = "123456";
int n = stoi(str);
cout << str;
return 0;
}