// Stack.cpp : Defines the entry point for the console application.
#include #include using typedef
_node
int
data;
struct
_node *next;
class
MyStack
private
:
public
:
while
(head)
delete
p;
void
Initialize(Node *h)
if
(head==NULL)
bool
Empty()
if
(head==NULL)
return true
;
else
return false
;
void
pushh(Node* h)
if
(head==NULL)
else
{ h->next=head; head=h; } }
int
pop()
if
(head==NULL)
return
-1;
else
{
int
val=head->data;
return
val;
return
head;
void
_tmain(int
argc, _TCHAR* argv[])
sizeof
(Node));
sizeof
(Node));
if
(s.Empty())
"the stack is empty"
<<endl;
else
cout<<s.top()->data; cin.get(); }
cout<<
ph->data=2;
s.pushh(ph);
s.pop();
p->data=1;
p->next=NULL;
s.Initialize(p);
Node* ph=(Node*)malloc(
{
MyStack s;
Node* p=(Node*)malloc(
}
};
}
}
Node* top()
{
head=head->next;
{
head=h;
{
}
{
head=h;
}
{
}
}
{
Node *p=head;
head=head->next;
MyStack()
{
head=NULL;
}
~MyStack()
{
Node* head;
{
}Node;
{
//
1043

被折叠的 条评论
为什么被折叠?



