Pla*_*men 1 c++ string double type-conversion
我正在实施这个:
double x;
ostringstream x_convert;
x_convert << x;
string x_str = x_convert.str();
Run Code Online (Sandbox Code Playgroud)
这看起来有点多余.有更优雅的方式吗?
Bar*_*rry 10
你在使用C++ 11吗?如果是这样,那就是:
auto x_str = std::to_string(x);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24104 次 |
| 最近记录: |