一、int 类型转换为 string 类型
示例:
#include <iostream>
#include <string>
int main()
{
double f = 23.43;
double f2 = 1e-9;
double f3 = 1e40;
double f4 = 1e-40;
double f5 = 123456789;
std::string f_str = std::to_string(f);
std::string f_str2 = std::to_string(f2); // 注意:返回 "0.000000"
std::string f_str3 = std::to_string(f3); // 注意:不返回 "1e+40".
std::string f_str4 = std::to_string(f4); // 注意:返回 "0.000000"
std::string f_str5 = std::to_string(f5);
std::cout << "std::cout: " << f << '\n'
<< "to_string: " << f_str << "\n\n"
<< "std::cout: " << f2 << '