// List the stack contents
else if (s=="list"){
// The only way to list the contents of the stack is to make a
// copy of it then pop all the elements off the copy
stack<double> stkcopy = stk;
if (stkcopy.empty()) {
cout << "Stack is empty" << endl;
} else {
cout << "Stack size = " << stkcopy.size() << endl;
while (!stkcopy.empty()) {
cout << stkcopy.top() << endl;
stkcopy.pop();
}
}
}