Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [ArrayBasedStack.cpp]
- * The ArrayBasedStack class definition/implementation.
- */
- #include "ArrayBasedStack.h"
- /**
- * ArrayBasedStack CLASS CONSTRUCTOR(s):
- */
- ArrayBasedStack::ArrayBasedStack()
- {
- top = -1;
- }
- /**
- * ArrayBasedStack CLASS ACCESSORS:
- */
- void ArrayBasedStack::Pop(float &item)
- {
- item = data[top];
- top--;
- }
- /**
- * ArrayBasedStack CLASS MUTATORS:
- */
- void ArrayBasedStack::Push(float item)
- {
- top++;
- data[top] = item;
- }
- /**
- * ArrayBasedStack CLASS GENERAL USE FUNCTIONS:
- */
- void ArrayBasedStack::MakeEmpty(void)
- {
- top = -1;
- }
- bool ArrayBasedStack::IsEmpty(void)
- {
- return (top == -1);
- }
- bool ArrayBasedStack::IsFull(void)
- {
- return (top == MAX_LENGTH);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement