1.int转string,函数to_string()
x=10; string m=to_string(x);
经测试gcc v5.4.0版本不支持,版本v7.5.0支持。判断版本号命令:g++ -v
同样适用于double,float
2.string转int,函数atoi()
string i="100"; cout << atoi(i.c_str())+1 << endl;
返回101
标签:类型转换,string,int,c++,版本,函数 From: https://www.cnblogs.com/RicL/p/16645735.html