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

📄 stack.cpp

📁 基于专家系统应用的程序代码 使用vc编程,access为数据库的程序
💻 CPP
字号:
// Stack.cpp: implementation of the CStack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mineDabse.h"
#include "Stack.h"

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

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

CStack::CStack()
{
 header=NULL;
}


CStack::~CStack()
{

}

void CStack:: push(CString str)
{
  stackList* node=new stackList();
  node->next=header;
  node->strData=str;
  header=node;  
}

CString CStack::pop()
{
  stackList* tempNode;
  CString tempStr;
  if(!empty())
  {
	  tempNode=header;
      header=header->next;
      tempStr=tempNode->strData;
      delete tempNode;
      return tempStr;
  }
  else 
	  return "";
}

bool CStack::empty()
{
  if (NULL==header)
	  return true;
  else 
	  return false;
}

void CStack::destroyStack()
{
	stackList* tempNode;
	while (header!=NULL)
	{    
      tempNode=header;
      header=header->next;   
      delete tempNode;
	}
}

⌨️ 快捷键说明

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