1234567891011121314151617181920212223242526
//snippet of stack.h class stack { static double runningtotal; enum{max = 10}; item items[10]; int top; public: stack(); bool pop(item & theitem); bool push(item & theitem); bool isfull(); bool isempty(); }; //snippet of stack.cpp bool stack::pop(item & theitem) { if (isempty()) return false; else { top--; /* ----> */ stack::runningtotal += theitem.payment; } return true; }
double stack::runningtotal;