1)题目
实现栈
要求:
实现一个栈,可以使用除了栈之外的数据结构
样例
push(1)
pop()
push(2)
top() // return 2
pop()
isEmpty() // return true
push(3)
isEmpty() // return false
2)思路
用vector实现栈
3)代码
//头文件
#pragma once
#include <iostream>
using namespace std;
#include<vector>
class Stack
{
private:
vector<int> stack_vector; // 栈空间的指针
int m_iTop = 0;