double and stringstream formatting

前端 未结 4 1445
半阙折子戏
半阙折子戏 2021-02-19 08:39
double val = 0.1;
std::stringstream ss;
ss << val;
std::string strVal= ss.str();

In the Visual Studio debugger, val has the value 0.

4条回答
  •  温柔的废话
    2021-02-19 08:50

    For anyone who gets "error: ‘setprecision’ is not a member of ‘std’" you must #include else setprecision(17) will not work!

提交回复
热议问题