mfc编写简单计算器工程包~只要很简单的运算就好

有点话滴滴845780561或者直接发邮箱
2025-04-03 14:32:47
推荐回答(1个)
回答1:

voidCCalDlg::OnButtonadd(){ //TODO:Addyourcontrolnotificationhandlercodehere UpdateData(); isresult=TRUE; num1=m_edit; m_edit=""; UpdateData(false); oper=1;}voidCCalDlg::OnButtondeng(){ //TODO:Addyourcontrolnotificationhandlercodehere UpdateData(); num2=m_edit; doubleresult=0; doublefirnum=atof(num1); doublesecnum=atof(num2); switch(oper) {case1:result=firnum+secnum; m_edit.Format("%g",result); UpdateData(false); break;}}在使用m_edit前,要先updatedata更新控件内容到变量。