C++ int float double 转string

std命令空间下有一个C++标准库函数std::to_string(),可用于将数值类型转换为string。使用时需要include头文件<string>


#include <string> //一定要有这个

double X =3.22225252525;

string x =to_string(X);//X可以使int float double 等类型


猜你喜欢

转载自blog.csdn.net/ZT_0910/article/details/79398588
今日推荐