要将字符串变量格式化为如"99.3%"这样的字符串,却不知道“%”如何格式化输出。我本意是这样的,百分比存在double变量percent中,输出字符串变量为strOut。代码如下:double percent;
percent=93.4;
CString strOut;
strOut.Format("%3.1lf%",percent);这样编绎通过。但执行时会出错。我还试过
strOut.Format("%3.1lf\%",percent);
strOut.Format("%3.1lf \%",percent);都不行。
应该如何写才对呢,请各位大侠赐教。
percent=93.4;
CString strOut;
strOut.Format("%3.1lf%",percent);这样编绎通过。但执行时会出错。我还试过
strOut.Format("%3.1lf\%",percent);
strOut.Format("%3.1lf \%",percent);都不行。
应该如何写才对呢,请各位大侠赐教。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货