科学计数法如何转换成普通的计数方式??
如:str1= "1.78e-002 "
怎么才能将str2 = "0.0178 "
[解决办法]
CString CGsCardCtrl::MatlabToFloat(CString strVal)
{
int nIndexE = 0;// 'e '所在位置
float lSvl = 0;// 'e '左侧的数值
int nCount = 0; // 'e '右侧的数值
CString strReturn = " ";
nIndexE = strVal.Find( 'e ');
lSvl = atof(strVal.Left(nIndexE));
nCount = atoi(strVal.Mid(nIndexE + 2, strVal.GetLength()));
if( "- " == strVal.Mid(nIndexE + 1, 1))
{
lSvl = lSvl / pow(10, nCount);
}
else
{
lSvl = lSvl * pow(10, nCount);
}
strReturn.Format( "%f ", lSvl);
return strReturn;
}