- 博客(0)
- 资源 (5)
- 收藏
- 关注
C++表达式求值12
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
typedef struct oprt // 存储操作符
{
char op;
struct oprt * link;
} OPRT;
typedef struct oprd // 存储操作数
{
double num;
struct oprd * link;
} OPRD;
/* 全局变量 */
OPRT * top_oprt = NULL; // 设置存取操作符的栈顶为空
OPRD * top_oprd = NULL; // 设置存取操作数的栈顶为空
/* 函数声明 */
void push_oprt(char c);
void push_oprd(double num);
2010-12-17
表达式的求解,可以是多位数和小数
#include
using namespace std;
const int MAX_SIZE = 100;
//堆栈类
template
class Stack
{
private:
Type list[MAX_SIZE];
int top;//标记
public:
Stack();
void Push(const Type & a);//入栈
Type Pop();//出栈
void Clear();//清空栈
Type GetTop();//获取栈顶元素
bool IsEmpty()const;//判断堆栈是否为空
bool IsFull()const;//判断堆栈是否满
};
2010-12-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人