超级简单问题:
如何把浮点数转换成字符串。
有没有和 itoa 类似的函数?
如何把浮点数转换成字符串。
有没有和 itoa 类似的函数?
解决方案 »
- 菜单资源与工具栏资源的 ID 为何是相同的呢?
- SDI工程,窗口分割为两部分,右侧窗口继承自CFormView,上面放一个tab control控件
- winxp的sdk中是否有类似于wince如下函数,或者谁能提供个自己实现的类库?谢谢
- 如何在CFormView上实现属性页??
- 请问怎么在OLE拖放使用自己定义的类型
- 一个关于滚动条的问题!
- 是不是vc的原因,高手请帮个忙!
- 高手赐教(非高手莫入!):vb+flash:在vb中使用flash控件(奇怪问题)
- 請問這是什麽錯誤,如何修改?
- 对话框中画线
- wndclass.cbClsExtra和wndclass.cbWndExtra有什么区别
- 关于ADO的应用程序配置问题
Converts a floating-point number to a string.char *_fcvt( double value, int count, int *dec, int *sign );
这个函数可以。
* 3.1415926535 to a string and sets the pointer
* *buffer to point to that string.
*/#include <stdlib.h>
#include <stdio.h>void main( void )
{
int decimal, sign;
char *buffer;
double source = 3.1415926535; buffer = _fcvt( source, 7, &decimal, &sign );
printf( "source: %2.10f buffer: '%s' decimal: %d sign: %d\n",
source, buffer, decimal, sign );
}
Outputsource: 3.1415926535 buffer: '31415927' decimal: 1 sign: 0
#include <string>
#include <iostream>
using namespace std;
void main()
{
stringstream ss;
ss<<3.14;
cout<<ss.str()<<endl;
}
CString sStr;
sStr.Format("%f",3.14f)