string与double的互相转换

Posted on 2018-07-05 00:15  禾小白  阅读(613)  评论(0编辑  收藏  举报
#include <iostream>  
#include <string>  
#include <sstream>  

string DoubleToString(double Input)  
{  
    stringstream Oss;  
    Oss<<Input;  
    return Oss.str();  
}  

double StringToDouble(string Input)  
{  
    double Result;  
    stringstream Oss;  
    Oss<<Input;  
    Oss>>Result;  
    return Result;  
}