Untitled
unknown
plain_text
6 months ago
595 B
1
Indexable
Never
#include<iostream> using namespace std; #define max 10000 int stack[max]; int top=-1; int queue[100]; int front=-1; int rear=-1; void enQueue(int x){ if(rear==max-1) rear=-1; rear++; queue[rear]=x; } int deQueue(){ if(front == max-1) front=-1; front++; return queue[front]; } bool isEmptyq(){ return front==rear; } void push(int x){ top++; stack[top]=x; } int pop(){ int x=stack[top]; top--; return x; } bool isEmpty(){ return top==-1; } int main(){ for(int i=0; i<10; i++){ push(i); enQueue(i); } cout<<deQueue(); return 0; }