C++ int 转 string (使用stringstream)

//-------------------------------------  
//功能:C++ int 转 string (使用stringstream)   
//-------------------------------------  
 
   
#include "stdafx.h"  
#include   
#include <string>  
#include   
using namespace std;  
 
   
int main()  
{  
    stringstream strStream;  
    int a = 100;  
    float f = 23.5566;  
 
   
    strStream << a << "----"<< f ;  
    string s = strStream.str();  
    cout << s << endl;  
 
   
    system("pause");  
    return 0;  
}  
 
  

转载于:https://www.cnblogs.com/hailexuexi/archive/2012/02/01/2334249.html

你可能感兴趣的:(c/c++)