⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mstack.cpp

📁 输入一个表达式子 然后输出 这个式子 的LL1文法形式
💻 CPP
字号:
// mstack.cpp: implementation of the Cmstack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "LL1.h"
#include "mstack.h"

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

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

Cmstack::Cmstack(TCHAR c)
{
	ch=c;
	next=NULL;
}

Cmstack::~Cmstack()
{

}

void Cmstack::push(Cmstack * & s,TCHAR c)
{
	Cmstack *temp=new Cmstack(c);
	if(s==NULL){
		s=temp;
	}else{
		temp->next=s;
		s=temp;
	}
}

void Cmstack::pop(Cmstack * & s)
{
	Cmstack *temp=s;
	if(temp!=NULL){
		s=s->next;
		delete temp;
	}
}

TCHAR Cmstack::get(Cmstack * & s)
{
	if(s!=NULL){
		return s->ch;
	}
	return _T('\0');
}

⌨️ 快捷键说明

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