Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C++ computer topics about defining plastic stack classes
C++ computer topics about defining plastic stack classes
intStack::intStack(int? Size/*? = 10? */)

{

top? =? - 1;

This-> Size? =? Size;

Data? =? New? int[size];

}

intStack::~intStack()

{

Delete? [] data;

}

Bull? intStack::Push(int? elem)

{

If (top? ==? Size? -? 1)

{

Return? Fake;

}

other

{

Data [++top]? =? elem

}

Return? True;

}

Bull? intStack::Pop(int? & ampelem)? //Stacking operation

{

If (top? ==? - 1)

{

Return? Fake;

}

other

{

elem? =? Data [top];

Data [top-];

}

Return? True;

}

int? intStack::Length(? )? const? //Get the number of elements in the stack

{

Return? Size;

}