📄 stack.cpp
字号:
// Stack.cpp: implementation of the CStack class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Stack.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CStack::CStack()
{
top = 0;
}
CStack::~CStack()
{
}
void CStack::push(CMyObject *E)
{
data[top++] = E;
}
CMyObject *CStack::pop()
{
if(top <= 0)
return NULL;
return data[--top];
}
CMyObject *CStack::getTop()
{
if(top <= 0)
return NULL;
return data[top - 1];
}
int CStack::getLength()
{
return top;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -