不使用c++11怎么把 int 转换成 std::string呢
#include <sstream>
#include <string>
#include <iostream>
std::string intToString(int value) {
std::stringstream ss;
ss << value; // 将int值插入到stringstream中
return ss.str(); // 从stringstream中获取字符串并返回
}
int main() {
int num = 123;
std::string str = intToString(num);
std::cout << "The string representation of " << num << " is: " << str << std::endl;
return 0;
}