⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calculatordlg.h

📁 Visual C++课程设计案例精编--计算器
💻 H
字号:
// CalculatorDlg.h : header file
//

#if !defined(AFX_CALCULATORDLG_H__8F15023D_4EA7_11D3_860D_A73AED693C48__INCLUDED_)
#define AFX_CALCULATORDLG_H__8F15023D_4EA7_11D3_860D_A73AED693C48__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CCalculatorDlg dialog

enum Operator { OpNone, OpAdd, OpSubtract, OpMultiply, OpDivide };
enum Func { FuncSin, FuncTan, FuncCos, FuncSqrt, FuncSqre, FuncLn, FuncLog,
             FuncN, FuncRec, FuncExp, FuncNone};
enum CalcError { ErrNone, ErrDivideByZero };

#define PI 3.1415926

class CCalculatorDlg : public CDialog
{
// Construction
public:
	CCalculatorDlg(CWnd* pParent = NULL);	// standard constructor

	float m_operand;
	float m_accum;
	BOOL m_bCoff;
	float m_coff;
	float DtoR;
	
	BOOL m_bIsExpand;
	CWnd* m_pMark;
	CRect rcSentific;
	CRect rcStandard;

	Operator m_operator;
	Func m_func;
	CalcError m_errorState;
	BOOL m_bOperandAvail;

	void Calculate();
	void Run_Func();
	void ExpandToSentific();
	void SetVisibleCtrl();
	void UpdateDisplay();
// Dialog Data
	//{{AFX_DATA(CCalculatorDlg)
	enum { IDD = IDD_CALCULATOR_DIALOG };
	CString	m_result;
	int		m_isDegree;
	int		m_sentific;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCalculatorDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;
	HACCEL m_hAccel;

	// Generated message map functions
	//{{AFX_MSG(CCalculatorDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnOperandInput(UINT nID); 
	afx_msg void OnAdd();
	afx_msg void OnMinus();
	afx_msg void OnDivid();
	afx_msg void OnMultiply();
	afx_msg void OnEqual();
	afx_msg void OnSqrt();
	afx_msg void OnSign();
	afx_msg void OnReciprocal();
	afx_msg void OnPoint();
	afx_msg void OnClear();
	afx_msg BOOL Keyboard(LPCTSTR szButton);
	afx_msg void OnLog();
	afx_msg void OnLn();
	afx_msg void OnFactorial();
	afx_msg void OnExp();
	afx_msg void OnSentific();
	afx_msg void OnSin();
	afx_msg void OnSquar();
	afx_msg void OnTan();
	afx_msg void OnStandard();
	afx_msg void OnDegree();
	afx_msg void OnRad();
	afx_msg void OnCos();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CALCULATORDLG_H__8F15023D_4EA7_11D3_860D_A73AED693C48__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -