using namespace std; if(node_num == 0) { SNode = mNode; } else { mNode->NextNode
ID: 3620519 • Letter: U
Question
using namespace std;
if(node_num == 0)
{
SNode = mNode;
}
else
{
mNode->NextNode = SNode;
SNode = mNode;
}
node_num++;
};
bool operators(T data)
{
if((data == '=')||(data == '+')||(data == '-')||(data == '*')||(data == '/')||(data == '^')||(data == '(')||(data == ')'))
return 1;
else
return 0;
}
void getTop(T data)
{
return SNode->Data;
}
bool isEmpty(void)
{
if(node_num == 0)
return true;
else
return false;
}
void printS()
{
NNode = SNode;
while(NNode)
{
cout<<NNode->Data<<endl;
NNode=NNode->NextNode;
}
}
int sizeS()
{
return node_num;
}
};
Explanation / Answer
#ifndef H_StackType #define H_StackType #include #include using namespace std; template class stackType { private : int maxStackSize; int stackTop; Type *list; public : void initializeStack(); bool isFullStack() const; bool isEmptyStack() const; void push( const Type& ); void pop(); Type top() const; stackType( int = 20 ); ~stackType(); }; template void stackType::initializeStack() { stackTop = 0; } template bool stackType::isFullStack() const { return ( stackTop == maxStackSize ); } template bool stackType::isEmptyStack() const { return ( stackTop == 0 ); } template void stackType::push( const Type& newItem ) { if ( !isFullStack() ) { list[ stackTop ] = newItem; stackTop++; } else coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.