Exercises 2.2
E2 (b):
Error_code copy_stack(Stack &dest,Stack &source)
{
Erroe_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==succes&&!temp.empty()}{
detected=temp.top(item);
detected=temp.pop();
if(detected==success)detected=source.push(item);
if(detected==success)detected=dest.push(item);
}
return detected;
}