Sun May 25, 2008 5:08 pm
#include "stack.h"
Stack::Stack()
{
topIndex=-1;
}
void Stack::push(StackElementType item)
{
++topIndex;
assert(topIndex < maxStackSize);
stackArray[topIndex]=item;
}
StackElementType Stack::pop()
{
assert(topIndex>=0);
int returnIndex(topIndex);
--topIndex;
return stackArray[returnIndex];
}
bool Stack::isEmpty()
{
return topIndex==-1;
}
#include "stack.h"
Stack::Stack()
{
topIndex=-1;
}
void Stack::push(StackElementType item)
{
++topIndex;
assert(topIndex < maxStackSize);
stackArray[topIndex]=item;
}
StackElementType Stack::pop()
{
assert(topIndex>=0);
int returnIndex(topIndex);
--topIndex;
return stackArray[returnIndex];
}
bool Stack::isEmpty()
{
return topIndex==-1;
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.