设为首页 加入收藏

TOP

C++四则表达式运算求值
2014-11-05 23:45:16 】 浏览:290
Tags:四则 表达式 运算

  #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;//判断堆栈是否满


  };


  template


  //堆栈初始化


  Stack::Stack()


  {


  top =0;


  }


  template


  //入栈


  void Stack::Push(const Type


  {


  if(top == MAX_SIZE)


  return;


  list[top++] = a;


  }


  //出栈


  template


  Type Stack::Pop()


  {


  return list[--top];


  }


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++隐藏指定窗体 下一篇朝花夕拾C++篇之全局变量&局部变量

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目