{
//TODO: add the control notification handler code
UpdateData(TRUE);
if (! M_str. IsEmpty ())//if m_str content isn't empty
{
M_str=m_str. Left (m_str. GetLength () - 1);//remove most the right side of a character
}
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum1 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "1";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum2 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "2";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum3 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str m_str +="3";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum4 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str m_str +="4";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum5 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str m_str +="5";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum6 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "6";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum7 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str m_str +="7";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum8 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "8";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum9 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "9";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedNum0 ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str=m_str + "0";
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedDian ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
If (1==m_str. Find ('. '))
{
M_str=m_str + ". ";
}
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedClear ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
M_str="";//will reset dialog
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedJia ()
{
//TODO: add the control notification handler code
SaveValue ();
M_iSign=0;
}
Void CjisuanqiDlg: : OnBnClickedJian ()
{
//TODO: add the control notification handler code
SaveValue ();
M_iSign=1;
}
Void CjisuanqiDlg: : OnBnClickedCheng ()
{
//TODO: add the control notification handler code
SaveValue ();
M_iSign=2;
}
Void CjisuanqiDlg: : OnBnClickedChu ()
{
//TODO: add the control notification handler code
SaveValue ();
M_iSign=3;
}
Void CjisuanqiDlg: : SaveValue ()
{
UpdateData(TRUE);
M_fNumber1=atof (m_str);//display the first input number
M_str="";//will edit box to empty
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : OnBnClickedDeng ()
{
//TODO: add the control notification handler code
UpdateData(TRUE);
The Calculator ();
The UpdateData (FALSE);
}
Void CjisuanqiDlg: : Calculator ()
{
UpdateData(TRUE);
M_fNumber2=atof (m_str);
Double f=0.0 f;
The switch (m_iSign)
{
Case 0:
F=m_fNumber1 + m_fNumber2;
break;
Case 1:
F=m_fNumber1 - m_fNumber2;
break;
Case 2:
F=m_fNumber1 * m_fNumber2;
break;
Case 3:
F=m_fNumber1/m_fNumber2;
break;
}
The UpdateData (FALSE);
}
CodePudding user response:
Tracking debugging is the basic skill,CodePudding user response:
To set breakpoints in function, first see couldn't enter into, or message response function is wrongCodePudding user response:
You that is equal to the number controls the inside of the response function f is what east east, you have to set up a control variable to save you take to the results, or you press the equals sign, function response, your values and have preserved update to the controls,CodePudding user response: