stack.cpp

来自「这是一个文法分析器」· C++ 代码 · 共 46 行

CPP
46
字号
// stack.cpp: implementation of the stack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "L1.h"
#include "stack.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

stack::stack()
{
st[0]='#';
	st[1]='E';
	st[2]='\0';
	top=2;
}

stack::~stack()
{

}
void stack::pop(){
	top--;
	st[top]='\0';
}


void stack::push(char *ch){
	int len, i;
	len=strlen(ch);
	for(i=len-1; i>=0; i--){
		st[top]=ch[i];
		top++;
		}
	
	st[top]='\0';
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?