转自 http://blog.csdn.net/codeeer/article/details/8907470 [cpp] view plain copy print ? #include <iostream> #include <string> #include <sstream> double转string [cpp] view plain copy print ? string DoubleToString(double Input) { stringstream Oss; Oss<<Input; return Oss.str(); } string转double [cpp] view plain copy print ? double StringToDouble(string Input) { double Result; stringstream Oss; Oss<<Input; Oss>>Result; return Result; } Demo: [cpp] view plain copy print ? int main() { double Str_1 = 12345.56789; string Str_2 = "12345.56789"; cout<<"Double --> String"<<endl; cout<<DoubleToString(Str_1)<<endl; cout<<"String --> Double"<<endl; cout<<StringToDouble(Str_2)<<endl; system("pause"); } 效果图: