-
#include
<sstream>
-
- void int2str(const int &int_temp,string &string_temp)
- {
- stringstream stream;
- stream<<int_temp;
- string_temp=stream.str(); //此处也可以用 stream>>string_temp
- }
-
- void str2int(int &int_temp,const string &string_temp)
- {
- stringstream stream(string_temp);
- stream>>int_temp;
- }
int和string类型互换
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Pimpl惯用法在dll导出的问题
yishang44
2020-07-06 05:17:47
MFC中VC6.0工程项目中文乱码的显示处理
yishang44
2020-07-06 05:17:37
C和C++语言学习总结(可以应对面试的题目)
C和C++語言學習總結(資料來自 <高質量C++/C 編程指南> 林銳博士 2001 年7 月24) 知識結構: 1、if,for,switch
kerwinpc
2020-07-04 00:22:38
c++ 使用枚举类型统一接口
wonengguwozai
2020-06-28 04:09:16
c++ Virtual关键字在类构造、析构函数使用与内存泄漏
wonengguwozai
2020-06-28 04:09:16
谈谈c++的仿函数(或称函数对象)
wonengguwozai
2020-06-28 04:09:16
CString、CStringA 和 CStringW
luliyuan
2020-06-28 02:26:38
引用,其实不可以改变指向
luliyuan
2020-06-28 02:26:38
Bitonic Sort
ucasliming
2020-06-24 06:53:13
C++堆与栈的区别
bluestream
2020-06-23 23:24:15
如何在Android中使用lame库
呆--呆
2020-06-21 16:05:43
c++学习记录之名称空间,命名空间
sgy1993
2020-06-20 11:56:10