Hey guys .. the following code is to reverse a list and it works just fine.. #in
ID: 3615966 • Letter: H
Question
Hey guys .. the following code is to reverse a list and it works just fine..
#include
using
struct
{
StackFrame *link;
};
typedef
class
{
public
Stack (): top(NULL)
{
}
~Stack ()
{
next = pop ();
}
{
StackFramePtr temp;
temp =
temp->value = no;
temp->link = top;
top = temp;
}
{
{
cout <<
exit (1);
}
top = top->link;
}
{
}
private
StackFramePtr top;
};
void
{
{
cout <<
<<
exit (1);
}
}
void
{
Stack stack;
StackFramePtr temp;
temp = head;
{
stack.push( temp->value);
temp = temp->link;
}
temp = head;
{
temp->value = stack.pop();
temp = temp->link;
}
}
void
{
cout << to_show->value << endl;
}
void
{
StackFramePtr temp =
temp->value = no;
temp->link = head;
head = temp;
}
int
{
StackFramePtr head =
head = NULL;
cout <<
cin >> number;
{
insert_head (head, number);
cin >> number;
}
checkList (head);
cout<<
showList (head);
cout <<
reverse (head);
showList (head);
}