c++怎样把double转为string

如题所述

ftoa:浮点数强制成字符串,

这个不是C标准库中的函数,而是Windows平台下扩展的,标准库中有sprintf,功能比这个更强,用法跟printf类似:
char str[255];
sprintf(str, "%f", 10.8); //将10.8转为字符串

c++中有itoa,没有ftoa,要使用自己编写。
一般用:
CString str;
str.Format("%f", 1.2345);
AfxMessageBox(str);
温馨提示:答案为网友推荐,仅供参考