Converting Double to String in C++

前端 未结 3 1867
迷失自我
迷失自我 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:53

    #include 
    
    std::string doubleToString(double val)
    {
       std::ostringstream out;
       out << std::fixed << val;
       return out.str();
    }
    

提交回复
热议问题