Homework Solution 1: stack.cc
// Push a value onto the stack
if (stack_size >= MAX_STACK_ITEMS)
cerr << "stack overflow!\n";
// Pop a value off of the stack
cerr << "stack underflow!\n";
return data[--stack_size];
Note: exceptions are a better way to report errors. We’ll learn about them if we have time tomorrow.