lexclass.h
来自「表达式的计算程序」· C头文件 代码 · 共 56 行
H
56 行
//////////////////////////////////////////////////////////////////////
//
// By Liutao
// Xi'an JiaoTong University, 2000.11
//
// LexClass.h: interface for the LexClass class.
//
//////////////////////////////////////////////////////////////////////
#include <afxtempl.h>
#if !defined(AFX_LEXCLASS_H__20BBA6B9_8618_4F70_AC2C_BDACFEB296E8__INCLUDED_)
#define AFX_LEXCLASS_H__20BBA6B9_8618_4F70_AC2C_BDACFEB296E8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
struct _element
{
union _u
{
double num;
char op;
}u;
int flag, p, p1;
};
class Lex
{
public:
CString GetString();
BOOL IsWrong();
double GetResult();
void GetFormula(CString str);
Lex();
virtual ~Lex();
protected:
BOOL IsOp();
BOOL pGreat();
void Cal();
void Push();
int GetP();
enum {NUM, OP, RAW=100, NOTRAW};
int GetNextElement();
_element element;
CList<_element, _element> opStack, numStack;
CString formula;
CString result_str;
private:
BOOL WithWrong;
CString pStr;
long i;
};
#endif // !defined(AFX_LEXCLASS_H__20BBA6B9_8618_4F70_AC2C_BDACFEB296E8__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?