C++ 任意类型 转 string

#include <sstream>

stringstream ss;

string str;

int a = 1;

float b = 1.1;

ss << a;

ss >> str;

ss.clear();

str.clear();

ss << b;

ss >> str;

你可能感兴趣的:(C++ 任意类型 转 string)