把CString类型的数字相加减
问题是有两CString字符数字,要对这两数字进行运算,菜鸟求指教,谢谢高手们!
MFC中。 CString 运算 MFC
[解决办法]
百度 “CString 转int”
[解决办法]
#include <stdio.h>
#include <stdlib.h>
#include <afx.h>
int main(void)
{
CString str1("1234"), str2("4321");
int x,y;
x= atoi((LPCTSTR)str1);
y= atoi((LPCTSTR)str2);
printf("x + y = %d\n",x+y);
return 0;
}