#include #include #include using namespace std; class Stack{ private : int *a; int top; public : Stack(){ top = -1; a = new int[10]; } void push(int element){ if(top >= 10) {cout<<"Stack overlow"; return;} else{ top++; a[top]=element; } } bool isEmpty(){ if(top<0) return true; else return false; } bool isFull(){ if(top==10) return true; else return false; } int pop(){ int temp; if(top<0) {cout<<"Stack underflow"; return NULL;} else{ temp = a[top]; a[top] = NULL; top--; } return temp; } void in(){ for(int i = 0; i <= top;i++){ cout<
Không có nhận xét nào: