calculator.h

来自「穷举法进行三八二十四的计算。列举所有可能的表达式进行计算筛选。」· C头文件 代码 · 共 34 行

H
34
字号
// Calculator.h: interface for the CCalculator class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CALCULATOR_H__FEC39822_B7E7_11D9_BEDA_000AEB106808__INCLUDED_)
#define AFX_CALCULATOR_H__FEC39822_B7E7_11D9_BEDA_000AEB106808__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define N  5
class CCalculator  
{
public:
	int compareR(char c1,char c2);
	double compute(double a,char op,double b);
	int compareL(char c1,char c2);
	CCalculator();
	enum {OK=0,NOOPERATOR};
	virtual ~CCalculator();
    int m_nStatus;
protected:
	double add(double a,double b);
	double sub(double a,double b);
	double product(double a,double b);
	double divide(double a,double b);
	static char m_nPriorityL[N][N];
	static char m_nPriorityR[N][N];
	static char m_cOperatorTable[N];
	double (CCalculator::*m_pfOperation[N])(double,double);
};

#endif // !defined(AFX_CALCULATOR_H__FEC39822_B7E7_11D9_BEDA_000AEB106808__INCLUDED_)

⌨️ 快捷键说明

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