NganXep

//ke tiep
#include<iostream>
#include<stdio.h>

using namespace std;

class Stack
{
    private:
        enum{size=32};
        int S[size];
        int T;

    public:
        Stack();
        void push(int x);
        int pop();
        bool isEmpty();
};

int main()
{
    cout<<endl;
    return 0;
}

Stack::Stack():T(-1){}

void Stack::push(int x)
{
    if(T==size-1)
    {
        cout<<"Ngan xep day!";
        return;
    }

    S[++T] = x;
}

int Stack::pop()
{ 
    if(T==-1)
    {
        cout<<"Ngan xep rong!";
        return 1;
    }

    return S[--T];
}

bool Stack::isEmpty()
{
    return T==-1;
}

Last updated