JAVA简单计算器程序设计

时间:2012-01-20 05:22:44
【文件属性】:
文件名称:JAVA简单计算器程序设计
文件大小:68KB
文件格式:DOC
更新时间:2012-01-20 05:22:44
设计 JAVA简单计算器程序设计 #include "math.h" class CCalculatorDlg : public CDialog { private: double m_dTempValue; // 存储中间变量 CString m_strType; // 判断运算类型:"+","-","*","/","=" bool m_bAppend; // 是否追加数字 // Construction public: CCalculatorDlg(CWnd* pParent = NULL); // standard constructor …… 在CalCClatorDlg.Cpp文件中,在其成员函数框架中添加运行代码(自行添加的语句在下面的程序中均以加粗字体显示)。 CalCClatorDlg构造函数中添加对成员变量的初始化代码: CCalculatorDlg::CCalculatorDlg(CWnd* pParent /*=NULL*/) : CDialog(CCalculatorDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCalculatorDlg) m_dEditResult = 0.0; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); // 初始化变量 this->m_dTempValue = 0; // 临时运算结果为0 this->m_dResult = 0; // 显示0 this->m_strType=""; // 表示无运算操作 this->m_bAppend = false; // 状态为输入新数据 }

网友评论