-
#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