一、int转string
int x; string a=to_string(x);
二、string转int
string a=”123”; int b= atoi(a.c_str()); int c=stoi(a); cout<<b<<’ ‘<<c<<endl;//答案 123 123
https://blog.csdn.net/weixin_53051813/article/details/124079501 这也是一种方法
string 转 int b = atoi(a.c_str())
改了改了
学会了
c可用b = stoi(a.c_str);
赞一个!
https://blog.csdn.net/weixin_53051813/article/details/124079501
这也是一种方法
string 转 int
b = atoi(a.c_str())
改了改了
学会了
c可用b = stoi(a.c_str);
赞一个!