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

📄 1.h

📁 对于c++primer中前面几章的练习以及书上的例子
💻 H
字号:

#ifndef 

using namespace std;

class iStack{
      public:
             iStack(int capacity)
             :_stack(capacity),_top(0){}
             bool pop(int &value)
             {if(empty())  return false;
             top_value=_stack[--top];
             cout<<"iStack::pop():"<<top_value<<endl;
             return true;     
                  };
             bool push(int value)
             {cout<<"iStack::push("<<value<<")\n";
             if(full()) return false;
             _stack[_top++]=value;
             return true;
             };
             bool full(){};
             bool empty(){ return _top?false:true;};
             void display()
             {
                  if(!size()){cout<<"(0)\n";return;}
                  cout<<"("<<size()<<")(bot:";
                  for(int ix=0;ix<_top;++ix)
                    cout<<_stack[ix]<<" ";
                    cout<<":top)\n";
                  }//{return _top<_stack.size()-1?false:true;};
             int size(){return _top;};
       private:
               int _top;
               vector<int>_stack; 
    };
//inline int iStack::size();
 

⌨️ 快捷键说明

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