While I am trying to print the stack twice, once before the reversal and once after it , why am i getting output only once but not twice?
s.push(1);
s.push(2);
s.push(3);
s.push(4);
s.push(5);
while(!s.empty()){
cout<<s.top()<<endl;
s.pop();
}
reverse(s);
while(!s.empty()){
cout<<s.top()<<endl;
s.pop();
}