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

📄 stack.cpp

📁 两个人工智能小程序
💻 CPP
字号:
// Stack.cpp: implementation of the CStack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AIWork1.h"
#include "Stack.h"

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

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

CStack::CStack()
{
	top=0;
}

CStack::~CStack()
{

}
int CStack::Length()
{
	return top;
}
int CStack::PopDirection()
{
	top--;
	if(top>=0)
		return data[top].direction;
	return -1;
}
void CStack::Push(datastruct m_data)
{
	data[top]=m_data;
	top++;
}

datastruct CStack::IndexValue(int index)
{
	if(index<top)
		return data[index];
	else
	{
		datastruct defaultvalue;
		for(int i=0;i<16;i++)
		{
			for(int j=0;j<16;j++)
				defaultvalue.datakey[i][j]=-1;
		}
		defaultvalue.direction=-1;
		return defaultvalue;
	}
}

void CStack::Init()
{
	top=0;
}

⌨️ 快捷键说明

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