本文共 852 字,大约阅读时间需要 2 分钟。
#include#include using namespace std;class myStack{ public: vector vec; int top = 0; myStack(int *arr, int l){ for (int i=0; i present(); cout << "判断栈是否为空:" << endl; cout << p->empty() << endl; p->present(); cout << "栈末尾插入数据:" << endl; p->push(100); p->present(); cout << "依次弹出栈末尾数:" << endl; while(!p->empty()){ cout << p->pop() << endl; } return 0;}
初始化栈:1 2 3 4 5判断栈是否为空:01 2 3 4 5栈末尾插入数据:1 2 3 4 5 100依次弹出栈末尾数:10054321
转载地址:http://zmwrf.baihongyu.com/