double转为string (intfloat等类似)
- Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include <string>
- #inlcude <sstream>
- int main(){
- double d=123.456;
- string str;
- stringstream ss;
- ss<<d;
- ss>>str;
- }
string转为double(intfloat等类似)
- Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include <string>
- #inlcude <sstream>
- int main(){
- double s;
- string str="123.56";
- stringstream ss;
- ss<<str;//从str输入
- ss>>s;//输出到double
- ss.clear();
- }