📄 za.cpp
字号:
#include"bianyi.h"
void InitStack(SqStack &Sqstack)
{
Sqstack.base=(SElemType *)malloc(100*sizeof(SElemType));
if(!Sqstack.base)
{
cout<<"error";
exit(1);
}
Sqstack.top=Sqstack.base;
Sqstack.stacksize=100;
}
int Rpop(int &Ltrace,int &Lptr,SqStack &Sqstack)
{
SElemType e;
if(Sqstack.top==Sqstack.base)
return 0;
else
{
e=*--Sqstack.top;
Lptr=e.Lptr;
Ltrace=e.Ltrace;
return 1;
}
}
void Rpush(int Ltrace,int Lptr,SqStack &Sqstack)
{
SElemType e;
if(Sqstack.top - Sqstack.base>=Sqstack.stacksize)
{
Sqstack.base=(SElemType *)realloc(Sqstack.base,(Sqstack.stacksize+=10)*sizeof(SElemType));
if(!Sqstack.base)
{
cout<<"error";
exit(1);
}
Sqstack.top=Sqstack.base+Sqstack.stacksize;
Sqstack.stacksize+=10;
}
e.Lptr=Lptr;
e.Ltrace=Ltrace;
*Sqstack.top++=e;
}
int Rempty(SqStack Sqstack)
{
if(Sqstack.top==Sqstack.base)
return 1;
return 0;
}
void Destroystack(SqStack &Sqstack)
{
while(Sqstack.base)
{
Sqstack.top=Sqstack.base+Sqstack.stacksize-1;
free(Sqstack.top);
Sqstack.stacksize--;
}
}
void Rtrail(SqStack &Sqstack,int Fiptr,bool Follow[][36])
{
SElemType *Mid;
Mid=(Sqstack.base);
while(Mid!=Sqstack.top)
{
Follow[Mid->Ltrace-128][Fiptr]=1;
Mid++;
}
}
void Epop(SqStack &Sqstack)
{
Sqstack.top=Sqstack.base;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -