Help on a stack of questions to establish a sequence
Users questions: How to use VC + + to create a simple order of the stack, would like to request a code, first thank you for it!
Experts answer: # include iostream.h typedefintdataType; ** abstract data type is defined as intc dataType lassStack1 ** order of the stack class (private: dataType * table; ** pointing to an array of pointers intsize; ** stack array capacity inttop; ** stack data elements subscript public: Stack1 (int n = 0); ~ Stack1 (); boolisEmpty ();** determine whether the state of the stack is empty boolisFull ();** determine the state of the stack is full boolpush (constdataTypek); ** stack dataT ypepop ();** a stack dataTypeget ();** access stack data element values, not the stack friendostream & operator (ostream & out, Stack1 & s); ** output data elements of each stack Value, the output stream operator overloading); Stack1:: Stack1 (intn) (table = NULL; if (n 0) (table = newdataType [n];) size = n; top =- 1;) Stack1:: ~ St ack1(){delete[]table;size=0;top=-1;}boolStack1::isEmpty(){return(table==NULL**top==-1);}boolStack1:: isFull(){return(table==NULL**top =size);}boolStack1::push(constdataTypek){if(!isFull()){top++;table[ top] = k; returntrue;) else (cout "stack is full," k "value can not stack! * n"; returnfalse;)) dataTypeStack1:: pop () (dataTypek; if (! IsEmpty ()) (k = table [top]; top **; returnk;) else (cout "stack is empty, no value of the stack! * N";) return-1;) dataTypeStack1:: get () (i f (! isEmpty ()) (returntable [top];) else (cout "stack is empty, no access to stack data element value! * n";) return-1;) ostream & operator (ostrea