C++中string类型对象和double型变量之间的互相转换

//convert string type value to double type value
string s = "23";
double d;
istringstream is(s);
is>>d;
cout<<d<<endl;   //输出23

 

//convert double type value to string type value
double d=45;
string s;
ostringstream os;
os<<d;
s = os.str();
cout<<s<<endl;  //输出45

C++中string类型对象和double型变量之间的互相转换,布布扣,bubuko.com

C++中string类型对象和double型变量之间的互相转换

上一篇:Xshell 连接 CentOS 7 与 Ubuntu Server


下一篇:DOM EVENT