Not a member of GistPad yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int q[5], front = 0, rear = -1, x;
- cout << "Enter element: ";
- cin >> x;
- if (rear == 4)
- cout << "Overflow";
- else
- q[++rear] = x;
- cout << "\nInserted: " << q[rear];
- if (front > rear)
- cout << "\nUnderflow";
- else
- cout << "\nDeleted: " << q[front++];
- return 0;
- }
RAW Paste Data
Copied
