Add every value in stack
- by rezivor
I am trying to figure out a method that will add every value in a stack.
The goal is to use that value to determine if all the values in the stack are even.
I have written to code to do this
template <class Object>
bool Stack<Object>::objectIsEven( Object value ) const {
bool answer = false;
if (value % 2 == 0)
answer = true;
return( answer );
}
However, I am stumped on how to add all of the stack's values in a separate method