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

📄 stack.cpp

📁 对堆栈进行了底层实现
💻 CPP
字号:
// Stack.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "AStack.h"
#include "LStack.h"
#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
/*	AStack<int> s(10);

	//test push() && pop() ppop
	s.Pop();
	s.Top();
	int a;
	for(int i = 1;i <= 11;i++)
		s.Push(i);
	while(!s.Empty())
	{
	//	cout << s.Top() << " ";
	//	s.Pop();
		s.PPop(a);
		cout << a << " ";
	}

	//test clear().size()
	for(int j = 1;j <= 10;j++)
		s.Push(j);
	cout << endl << s.Size() << endl;
	s.Clear();
	cout << endl << s.Size() << endl;*/

	LStack<int> ls;
	//test push && pop && top
	for(int i = 1;i <= 10;i++)
		ls.Push(i);
	cout << ls.Size() << endl;

	//
	ls.Clear();
	while(!ls.Empty())
	{
		cout << ls.Top() << " ";
		ls.Pop();
	}
	cout << endl;
	cout << ls.Size() << endl;
	ls.Top();
	ls.Pop();
	return 0;
}

⌨️ 快捷键说明

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