title: my DeQueue() function is not working properly
body: <p>When I run the delete function its gives me some garbage value to infinity. what's the problem?</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;process.h&gt;
  #include&lt;conio.h&gt;
  using namespace std;
  class circularqueue
  {
    int arr[5];
    int front,rear;
    int size;
    int count;
    public:
       circularqueue()
       {
        count = -1;
        front=-1;
        rear=-1;
        size=5;
       }
       void display();
       void enqueue(int val);
       void delete_element();
       bool Is_empty();
  };
  
  bool circularqueue::Is_empty(){
      if(front == -1 &amp;&amp; rear == -1){
          return true;
      }
      else {
          return false;
      }
   }
  void circularqueue :: display()
  {
      int F = front;
      for(count; count!=0;count--){
          cout&lt;&lt;"-----------"&lt;&lt;endl;
          cout&lt;&lt;"ID is : "&lt;&lt;arr[F]&lt;&lt;endl;
          cout&lt;&lt;"-----------"&lt;&lt;endl;
          F++;
          if(count == (size-1)){
              F=0;
          } 
          else if(count == -1){
              cout&lt;&lt;"Empty"&lt;&lt;endl;
          }
      }
  }
  
  void circularqueue :: enqueue(int val)
  {
       if(Is_empty()){
       // cout&lt;&lt;"Queue is empty "&lt;&lt;endl;
          ++front;
          ++rear;
          arr[rear] = val;
       }
       else if(front == 0 and rear == (size-1)){
          cout&lt;&lt;"Queue is Full"&lt;&lt;endl;
       }
       else if(front==0 &amp;&amp; rear == 0){
          if(rear&lt;=(size-1)){
              arr[rear]= val;
              rear = rear+1;
          }
       }
       else if(front!=0 &amp;&amp; rear == (size-1)){
          rear=0;
          arr[rear]=val;
          rear =rear+1;
       }
       else {
          arr[rear] = val;
          rear=rear+1;
       }
       count++;
  }
  </code></pre>
  
  <p>When I run this code the delete function it does not work properly please tell me the fix.</p>
  
  <p>It gives my some garbage value and it looks like an infinite loop</p>
  
  <pre><code>void  circularqueue :: delete_element()
  {
      if(Is_empty()){
          cout&lt;&lt;"The Queue is empty"&lt;&lt;endl;
      }
      else if(front==(size-1)){
          front = 0;
      }
      else if(front == rear){
          front = -1;
          rear = -1;
      }
      else 
      {
          cout&lt;&lt;"Number Deleted : "&lt;&lt;front&lt;&lt;endl;
          front = front+1;
      }
      count--;
  }
  int main()
  {
      circularqueue obj;
  
       int num;
       int ch;
       char ch1;
  jb:  cout&lt;&lt;" 1 - EnQUEue   2- DeQueue  3- Display"&lt;&lt;endl;
       cin&gt;&gt;ch;
       switch(ch){
          case 1:{
              cout&lt;&lt;"Enter Number : "&lt;&lt;endl;
              cin&gt;&gt;num;
            obj.enqueue(num);
            cout&lt;&lt;"Return to Main Menu: "&lt;&lt;endl;
            cin&gt;&gt;ch1;
            if(ch1=='Y'|| ch1=='y'){
              system("cls");
              goto jb;
             }
              break;
           }
           case 2:{
              obj.delete_element();
               cout&lt;&lt;"Return to Main Menu: "&lt;&lt;endl;
            cin&gt;&gt;ch1;
            if(ch1=='Y'|| ch1=='y'){
              system("cls");
              goto jb;
             }
  
              break;
           }
           case 3:{
                  obj.display();
                   cout&lt;&lt;"Return to Main Menu: "&lt;&lt;endl;
            cin&gt;&gt;ch1;
            if(ch1=='Y'|| ch1=='y'){
              system("cls");
              goto jb;
             }
  
              break;
           }
           default :{
              cout&lt;&lt;"Invalid entery  "&lt;&lt;endl;
               cout&lt;&lt;"Return to Main Menu: "&lt;&lt;endl;
            cin&gt;&gt;ch1;
            if(ch1=='Y'|| ch1=='y'){
              system("cls");
              goto jb;
             }
              break;
           }
       }
  }
  </code></pre>