#include #include using namespace std; struct Stack { int* arr; int N; int top; Stack(int size) { arr = new int[size]; N = size; top = -1; } bool isEmpty() { return top == -1; } bool isFull() { return top == N - 1; } int pop() { if (!isEmpty()) return arr[top--]; } void push(int value) { if (!isFull()) arr[++top] = value; } void print() { for (int i = 0; i < 7; i++) cout << pop() << endl; } }; int main() { Stack stk(7); stk.push(1); stk.push(3); stk.push(-3); stk.push(-1); stk.push(7); stk.push(2); stk.push(9); stk.print(); _getch(); return 0; }