Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool isEmpty(int n)
- {
- if (!n)
- return false;
- return true;
- }
- int peek(int stiva[],int n)
- {
- return stiva[n];
- }
- void PUSH(int stiva[],int &n,int x)
- {
- stiva[++n]=x;
- }
- int POP(int stiva[],int &n)
- {
- int r=peek(stiva,n);
- n--;
- return r;
- }
- int main()
- {
- int stiva[100], k = 0;
- PUSH(stiva, k, 2);
- PUSH(stiva, k, 4);
- PUSH(stiva, k, 6);
- PUSH(stiva, k, 7);
- PUSH(stiva, k, 8);
- cout << POP(stiva, k);
- cout << POP(stiva, k);
- cout << POP(stiva, k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement