不想声明个变量,然后在转化 ,
int i=123;
CString str;
str.Format("%d",i);
AfxMessageBox(str); //MessageBox 等都可以要写4行,这样很繁琐怎样在一两行实现这功能?int i=123;
AfxMessageBox(i);
int i=123;
CString str;
str.Format("%d",i);
AfxMessageBox(str); //MessageBox 等都可以要写4行,这样很繁琐怎样在一两行实现这功能?int i=123;
AfxMessageBox(i);
TRACE("%d", i);
{
CString str;
str.Format("%d",i);
AfxMessageBox(str); //MessageBox 等都可以
}这样以后:
int i=123;
MessageBoxInt (i);
CString ShowInt(int i)
{
CString s;
s.Format();
return s;
}
#define AfxMessageBox(i) {CString str;str.Format("%d",i);AfxMessageBox(str);} //使用
int i=123;
AfxMessageBox(i);
#ifdef _DEBUG
#define AfxMessageBox_Debug(i) {CString str;str.Format("%d",i);AfxMessageBox(str);}
#else
#define AfxMessageBox_Debug(i) {}
#endif//使用
int i = 123;
AfxMessageBox_Debug(i);
AfxMessageBox("Test");
AfxMessageBox("123"); 这样行吧,我可没试过,不行别骂啊
void MessageBoxInt(int i){CString str;str.Format("%d",i);AfxMessageBox(str);}
#else
void MessageBoxInt(int i){}
#endif