```cpp
#include <iostream>
using namespace std;
#define MaxSize 10
typedef struct LStackNode{
int data;
struct LStackNode *next;
}LStackNode,*LiStack;
void InitSqStack(LiStack &lst);
bool IsEmpty(LiStack lst);
bool Push(LiStack &lst,int x);
bool Pop(LiStack &lst,int &x);
bool GetTop(LiStack lst,int &x);
int Length(LiStack lst);
int main()
{
LiStack lst;
InitSqStack(lst);
cout<<IsEmpty(lst)<<endl;
for(int i=0;i<5;i++)
Push(lst,i);
cout<<IsEmpty(lst)<<endl;
int ans;
cout<<GetTop(lst,ans)<<endl;
cout<<ans<<endl;
cout<<Length(lst)<<endl;
}
void InitSqStack(LiStack &lst)
{
lst=(LStackNode*)malloc(sizeof(LStackNode));
lst->next=NULL;
}
bool IsEmpty(LiStack lst)
{
return (lst->next==NULL);
}
bool Push(LiStack &lst,int x)
{
LStackNode*p=(LStackNode*)malloc(sizeof(LStackNode));
p->next=NULL;
p->data=x;
p->next=lst->next;
lst->next=p;
}
bool Pop(LiStack &lst,int &x)
{
if(lst->next==NULL)return false;
x=lst->next->data;
LStackNode*p;
p=lst->next;
lst->next=lst->next->next;
free(p);
return true;
}
bool GetTop(LiStack lst,int &x)
{
if(lst->next==NULL)return false;
x=lst->next->data;
return true;
}
int Length(LiStack lst)
{
int k=0;
LStackNode*p=lst;
while (p->next!=NULL)
{
p=p->next;
k++;
}
return k;
}