C++基础语言


其他格式转换string

使用stringstream

#include <string>
#include <sstream>
using namespace std;
int main()
{
	stringstream strStream;
	int code = 100;
	float value = 10.8;
	strStream << "code:" << code << ",value:" << value;
	string content = strStream.str();
	return 0;
}