CString Format 精度是变量

环境:vs2003

问题:如果我的精度是个变量,结果根据这个变量而进行不同的格式化

代码:

int m=6;
    double f=0.11;
    CString strFormat1,strFormat2,strFormat3;
    strFormat1.Format(_T("%%0.%df"), m);
    strFormat2.Format(strFormat1, f);
    strFormat3.Format(_T("%0.6f"), f);
    AfxMessageBox(strFormat2);

结果:Format参数1也是接受一个字符串,无论是常量字符串还是一个CString变量

你可能感兴趣的:(点点滴滴)