一个减法器,结果不对,求助。
void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
switch(id)
{
case IDC_OK:
{
TCHAR str1[256];
TCHAR str2[256];
GetDlgItemText(hwnd,IDC_EDIT1,str1,sizeof(str1));
GetDlgItemText(hwnd,IDC_EDIT2,str1,sizeof(str2));
int in1=atoi(str1);
int in2=atoi(str2);
int out=in1-in2;
TCHAR out1[256];
itoa(out,out1,10);
//wsprintf(out1,"%i",out);
SetDlgItemText(hwnd,IDC_EDIT3,out1);
}
break;
default:
break;
}
}
得到的结果和减数总是相同,求解。
[解决办法]