具体实现的函数代码、、、
void CMyDlg::OnAdd()
{
// TODO: Add your control notification handler code here
double a,b,c;
char ch1[15],ch2[15],ch3[15];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,15);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,15);
a=atoi(ch1);
b=atoi(ch2);
c=a+b;
itoa(c,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}
void CMyDlg::OnSub()
{
// TODO: Add your control notification handler code here
double a,b,c;
char ch1[15],ch2[15],ch3[15];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,15);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,15);
a=atoi(ch1);
b=atoi(ch2);
c=a-b;
itoa(c,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}
void CMyDlg::OnCheng()
{
// TODO: Add your control notification handler code here
double a,b,c;
char ch1[15],ch2[15],ch3[15];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,15);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,15);
a=atoi(ch1);
b=atoi(ch2);
c=a*b;
itoa(c,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}
void CMyDlg::OnChu()
{
// TODO: Add your control notification handler code here
double a,b,c;
char ch1[15],ch2[15],ch3[15];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,15);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,15);
a=atoi(ch1);
b=atoi(ch2);
c=a/b;
itoa(c,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}