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;
}
转载于:https://www.cnblogs.com/ywq-930214/p/3289714.html