我高不高 if(iB<0 || iB>4){iB=4;}我改成了if((UINT)iB > 4){iB=4;} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 strBaseText = _T(""); for (int i=0;i<iBit;i++) { strBaseText += _T("0"); }感觉这样,如果要得到100个0的串的话,效率不高,但也懒得想算法了,所以把这事儿交给MFC吧CString strTemp; strTemp.Format(_T("%%0%d"), iBit); strBaseText.Format((LPTSTR)(LPCTSTR)strTemp, 0); 我老是在纠结小问题,这可怎么办strBaseText永远是N个0+1个char的字符串,但需要大写,直接这样就可以了SetWindowText(strBaseText.MakeUpper());但我觉得,为了让一个字符大写,却要让MakeUpper遍历整个字符串,不划算,所以自己写了个MakeUpper(char)的函数strBaseText+MakeUpper(s) 哦,看来我还是小看了原来的自己,MakeUpper不但将字符变大写,而且判断了非法字符,因为表示方向的只有ewns 感觉这样,如果要得到100个0的串的话,效率不高,但也懒得想算法了,所以把这事儿交给MFC吧CString strText(_T(""));int nValue = 0;strText.Format(_T("%0100d"), nValue);AfxMessageBox(strText); CString strTemp; strTemp.Format(_T("%%0%dd"), iBit); strBaseText.Format((LPTSTR)(LPCTSTR)strTemp, 0); CString strText(_T("")); int nValue = 0; int nIndex = 10; CString strIndex(_T("")); strIndex.Format(_T("%%0%dd"),nIndex); AfxMessageBox(strIndex); // %05 strText.Format(strIndex, nValue); AfxMessageBox(strText); int比较安全啊iB = ((iB >= 0) && (iB <= 4)) ? iB : 4; iB是个很大的正数,所以它大于4,所以同时会进if CDockablePane如何切割成上下两块 vc 实现图片的像素大小改变 HKLM\SECURITY读取问题,100分 在程序中调用“时间、日期属性”对话框 Edit(MultiLine) and CFormView主窗口的滚动条 CreateProcessAsUser打开的进程再打开IE时,收藏夹中的内容消失。是安全属性的问题吗? mfc的activx的菜问题 vc6.0中的LINK命令怎么用? 怎样在WIN2000下使用_outp()函数,help me,thank you!!!!!!! 添加换行的操作 关于完成例程模型 关于设置定时器来统计执行代码的时间问题
for (int i=0;i<iBit;i++)
{
strBaseText += _T("0");
}感觉这样,如果要得到100个0的串的话,效率不高,但也懒得想算法了,所以把这事儿交给MFC吧
CString strTemp;
strTemp.Format(_T("%%0%d"), iBit);
strBaseText.Format((LPTSTR)(LPCTSTR)strTemp, 0);
strBaseText永远是N个0+1个char的字符串,但需要大写,直接这样就可以了
SetWindowText(strBaseText.MakeUpper());
但我觉得,为了让一个字符大写,却要让MakeUpper遍历整个字符串,不划算,所以自己写了个
MakeUpper(char)的函数
strBaseText+MakeUpper(s)
MakeUpper不但将字符变大写,而且判断了非法字符,因为表示方向的只有ewns
int nValue = 0;
strText.Format(_T("%0100d"), nValue);
AfxMessageBox(strText);
strTemp.Format(_T("%%0%dd"), iBit);
strBaseText.Format((LPTSTR)(LPCTSTR)strTemp, 0);
int nValue = 0;
int nIndex = 10;
CString strIndex(_T(""));
strIndex.Format(_T("%%0%dd"),nIndex);
AfxMessageBox(strIndex); // %05
strText.Format(strIndex, nValue);
AfxMessageBox(strText);
iB = ((iB >= 0) && (iB <= 4)) ? iB : 4;