#include <iostream.h> #include <string.h> #include <assert.h> //ch_stack implementation with constructor. class ch_stack { public: //the public interface for the ADT ch_stack ch_stack(); ch_stack(int size, const char str[]); ch_stack(const char* c); explicit ch_stack(int size); void reset() { top = EMPTY; } void push(char c) { assert(top != FULL); top++; s[top] = c; } char pop() { assert(top!= EMPTY); return s[top--]; } char top_of() { assert(top!= EMPTY); return s[top]; } int empty() const { return (top == EMPTY); } int full() const { return (top == max_len - 1); } private: enum { EMPTY = -1, FULL = 101 }; char* s; //changed from s[max_len] int max_len; int top; };