#include <iostream> // std::cout, std::ios #include <sstream> // std::ostringstream using namespace std; std::string doubleToString(double val) { std::ostringstream out; out << std::fixed << val; return out.str(); } int main() { cout << doubleToString(554.2) << endl; return 0; } /* OUTPUT: 554.200000 */