类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
操作系统:WINXP+SP2
开发工具:VC6
语言:C
如是。
网友回答:
atof
或_gcvt等函数是可以的。
float f;
CString str;
str.Format("%f",str);
//int 类似
要用MFC,以下是我的
void CTestmfcDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CString x;
x.Format("%f",1.222);
MessageBox(x);
}
你的错误是什么?
#include "stdio.h"
char buf[100] ;
float f1 = 100.303;
HDC hdc;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
RECT rt;
GetClientRect(hWnd, &rt);
memset (buf, 0, 100);
sprintf (buf, "%f",f1);
DrawText(hdc, buf, strlen(buf), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;