文档介绍:: .
〈〈数据结构与算法分析》课程设计报告
课题名称:带括号的算术表达式求值实验报告一、实验一:带括号ntry>(item,top_node);
if(new_top==NULL)returnoverflow;
top_node=new_top;
returnsuccess;}template<classStack_entry>Error_codeStack<Stack_entry>::pop()/*Post:
isemptythemethodreturnsunderflow;otherwiseitreturnssuccess.
*/{
Node<Stack_entry>*old_top=top_node;
if(top_node==NULL)returnunderflow;
top_node=old_top->next;
deleteold_top;
returnsuccess;}template<classStack_entry>Error_codeStack<Stack_entry>::top(Stack_entry&item)const{
Error_coderesult;
if(empty())
returnunderflow;
else{
item=top_node->entry;
returnsuccess;
}}template<classStack_entry>voidStack<Stack_entry>::clear()//clearelememt/*Post:TheStackiscleared.
*/{
while(!empty())
pop();template<classStack_entry>Stack<Stack_entry>::~Stack()//Destructor/*Post:TheStackiscleared.*/{clear();}template<classStack_entry>Stack<Stack_entry>::Stack(constStack<Stack_entry>&original)//copyconstructor/*Post:TheStackisinitializedasacopyofStackoriginal.*/{Node<Stack_entry>*new_copy,*original_node=;if(original_node==NULL)top_node=NULL;else{//Duplicatethelinkednodes.
top_node=new_copy=newNode<Stack_entry>(original_node->entry);while(original_node->next!=NULL){original_node=original_node->next;new_copy->next=newNode<Stack_entry>(original_node->entry);new_