C++任意类型转化成字符串

#include <iostream>
#include <string>
#include <sstream>

int main(int argc, char** arg){
	using namespace std;
	string s1 = "1";
	ostringstream os;
	os << s1 << 1 << "---" << 0.235;
	s1 = os.str();
	cout << s1 << endl;

	getchar();
	return 0;
}


转载请注明:康瑞的部落 » C++任意类型转化成字符串

你可能感兴趣的:(C++)