E2.(b) Use the Stack methods and a temporary Stack to retrieve entries from the Stack source and add each entry to the Stack dest and restore the Stack source.
Error_code copy_stack(Stack &dest,Stack &source) {
Error_code detected=success;
Stack temp;
Stack_entry item;
while(detected==success&&!source.empty()) {
detected=source.top(item);
detected=source.pop();
if(detected==success)detected=temp.push(item);
}
while (detected==success&&!temp.empty()) {
detected=temp.top(itemp);
detected=temp.pop();
if (detected==success)detected=source.push(item);
if (detected==success)detected=dest.push(item);
}
return detected;
}