Converting Double to String in C++

前端 未结 3 1952
迷失自我
迷失自我 2020-12-31 12:00

I am having some issues trying to convert a double to C++ string. Here is my code

std::string doubleToString(double val)
{
    std::ostringstream out;
    ou         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-31 12:47

    You can also set the minimum width and fill char with STL IO manipulators, like:

    out.width( 9 );
    out.fill( ' ' );
    

提交回复
热议问题