Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "stack.h"
const char* Stack::Full::what() const throw()
{
return "Stack is full";
}
const char* Stack::Empty::what() const throw()
{
return "Stack is empty";
}
Stack::Stack( const int _maxSize ) : maxSize(_maxSize)
{
/* this is going to dynamically allocate an array of chars
I'm doing it with a smart pointer to be absolutely certain
there's no memory leak */
stack = std::make_unique<char[]>( maxSize );
numValues = 0;
}
Stack::~Stack()
{
}
int Stack::num_items() const
{
return 0;
}
void Stack::push( char value )
{
if( num_items() < maxSize )
{
stack[numValues] = value;
numValues += 1;
}
else
{
throw Full();
}
}
char Stack::top()
{
}
char Stack::pop()
{
}