Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int top = -1;
- int a[6];
- void tops()
- {
- top++;
- }
- void push(int x)
- {
- tops();
- a[top] = x;
- }
- void pop()
- {
- top--;
- }
- void print()
- {
- cout << "Stack Content = " << a[top] << " top = " << top << "\n";
- }
- int main()
- {
- push(15); print();
- push(25); print();
- push(35); print();
- push(45); print();
- pop(); print();
- push(65);print();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement