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

📄 vertexstack.cpp

📁 这是我写的数据结构的课设
💻 CPP
字号:
// VertexStack.cpp: implementation of the CVertexStack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "CollegeWizard.h"
#include "VertexStack.h"
#include "Vertex.h"

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

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

CVertexStack::CVertexStack()
{
	list = NULL;
}

CVertexStack::~CVertexStack()
{
	struct node* temp = list;
	while(temp)
	{
		list = list->next;	
		delete temp;
		temp = list;
	}
}
//////////////////////////////////////////////////////////////////////
CVertex* CVertexStack::Pop()
{
	struct node* temp = list;
	if(list)
	{
		list = list->next;
		return temp->vertex;
		delete temp;
	}
	else return NULL;
}

void CVertexStack::Push(CVertex *vertex1)
{
	struct node* temp = new node;
	temp->next = list;
	temp->vertex = vertex1;
	list = temp;
}

BOOL CVertexStack::IsEmpty()
{
	return list == NULL? TRUE : FALSE;
}
//////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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