add double to string in c++ code example Example: appending a double to a string c++ std::ostringstream strs; strs << dbl; std::string str = strs.str();