7楼的方法都试了,str.Format(L"%.2f",a);这种会出现无法参数转化的错误,加T的话,没有用,还是指向atlsimpstr.h文件, 唉,这个问题折磨好几天了
其实,我已经试过这种可能了,还是错误。我看了程序,出现错误的都是CString类,而且最后的断点都指向 CStringData *GetData() const throw() { return (reinterpret cast<CStringData *>(m_pszData)-1); }这个位置
#include <StdAfx.h> #include<iostream> #include <afxwin.h> using namespace std; int main(int argc, char* argv[]) { CString str; float a = 0; str.Format(_T("%.2f"),a); cout << a << endl; system("pause"); }
70,019
社区成员
243,267
社区内容
加载中
试试用AI创作助手写篇文章吧