From 17730fcae97461784af06dbdd58ccfb7f94890f9 Mon Sep 17 00:00:00 2001 From: pratikrpawar <56465066+pratikrpawar@users.noreply.github.com> Date: Wed, 27 Oct 2021 22:07:36 +0530 Subject: [PATCH] Create circularqueue.cpp --- circularqueue.cpp | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 circularqueue.cpp diff --git a/circularqueue.cpp b/circularqueue.cpp new file mode 100644 index 0000000..e3e8bd5 --- /dev/null +++ b/circularqueue.cpp @@ -0,0 +1,113 @@ +//this is program for circular-queue in C++ languauge + +#include +using namespace std; +int q[4]; +int f=-1; +int r=-1; +void insert_element() +{ + + if(f==0 and r==3 or f==r+1) + { + + cout<<"Queue overflow....!!"<>ele; + r=(r+1)%4; + q[r]=ele; + cout<<"Element inserted in Queue sucessfully...."<>i; + switch(i) + { + case 1: + insert_element(); + break; + case 2: + remove_element(); + break; + case 3: + display(); + break; + case 4: + exit(0); + } +}while(true); + + + + +}