appending a double to a string c++

C++
std::ostringstream strs;
strs << dbl;
std::string str = strs.str();
Source

Also in C++: