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 FRONT(int coada[],int n)
- {
- return coada[1];
- }
- void PUSH(int coada[],int &n,int x)
- {
- coada[++n]=x;
- }
- int POP(int coada[],int &n)
- {
- int r=FRONT(coada,n);
- for (int i=1; i<n; i++)
- coada[i]=coada[i+1];
- n--;
- return r;
- }
- int main()
- {
- int coada[100],k=0;
- PUSH(coada, k, 2);
- PUSH(coada, k, 4);
- PUSH(coada, k, 6);
- PUSH(coada, k, 7);
- PUSH(coada, k, 8);
- cout << POP(coada, k);
- cout << POP(coada, k);
- cout << POP(coada, k);
- cout << POP(coada, k);
- cout << POP(coada, k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement