需要的头文件:#include<sstream>
操作:
string s1="124";
int x;
stringstream ss;
ss<<s1;
ss>>x;
C++中将string类型变量转换成int型变量,布布扣,bubuko.com
时间: 2024-12-27 15:16:59
需要的头文件:#include<sstream>
操作:
string s1="124";
int x;
stringstream ss;
ss<<s1;
ss>>x;
C++中将string类型变量转换成int型变量,布布扣,bubuko.com