#Code:
#include<iostream> #include<stack> using namespace std; int main() { /* Create a stack */ stackdata; /* Push data into the stack */ data.push(10); data.push(20); data.push(30); data.push(40); cout << "Stack size: " << data.size() << endl; cout << "Data on top of the stack: " << data.top() << endl; /* Pop data from the stack */ data.pop(); cout << "Stack size after pop: " << data.size() << endl; cout << "Now top data on stack: " << data.top() << endl; return 0; }
0 Comment:
Đăng nhận xét
Thank you for your comments!