Code not giving output

#include
#include
using namespace std;

class stack{
private:
vector v;
public:

void push(int data){
    v.push_back(data);
}
bool empty(){
    return v.empty()==0;
}
void pop(){
    if(!empty()){
        return v.pop_back();
    }
}
int top(){
    return v[v.size()-1];
}

};

int main(){
stack s;

for(int i=1;i<=5;i++){          
    s.push(i*i);
}


while(!s.empty()){
    cout<<s.top()<<endl;
    s.pop();
}
return 0;

}

@dhruvj797,


correction done and commented

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.