#include<iostream>
#include<string>
#include<sstream>
using namespace std;
template<typename T>
void to_string(T value) {
std::ostringstream os;
os << value;
return os.str;
}
int main() {
int lcc1 = 1;
long lcc2 = 122;
double lcc3 = 2.1;
string s1 = to_string(lcc1);
string s2 = to_string(lcc2);
string s3 = to_string(lcc3);
cout << s1 << "\n" << s2 << "\n" << s3 << endl;
}

C++中将数字转换为字符串_#include