如果输出一个浮点数
Stemp.Format("%.4f,",x);
这个是输出小数点后4位有效数字. 请问如何能随意设置小数点后面多少位有效果数字
如果我用一个combom来让用户选择输出多少位有效果数字. 1.2.3....
程序不用if语句或switch语句就可以根据用户的选择输出浮点数
Stemp.Format("%.4f,",x);
这个是输出小数点后4位有效数字. 请问如何能随意设置小数点后面多少位有效果数字
如果我用一个combom来让用户选择输出多少位有效果数字. 1.2.3....
程序不用if语句或switch语句就可以根据用户的选择输出浮点数
strFormat.Format("%%.%df", nSel+1);// 假定 nSel 从 0 开始
Stemp.Format(str1,x);
CString strText(_T(""));
float f = 2.3243253f;
strText.Format(_T("%.*f"), nCount, f);
AfxMessageBox(strText);
CString m_comboStr = "";
m_combo.GetLBText(index,m_comboStr);
CString m_formatStr = "%."+ m_comboStr+"f";//限制输出格式 "%.4f"
double f = 12345.12345;
CString str;
str.Format(m_formatStr,f);
MessageBox(str);