Guest User

Untitled

a guest
Apr 26th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. # include<iostream>
  2. # include<conio.h>
  3.  
  4. # define SIZE 90
  5.  
  6. using namespace std;
  7.  
  8.  
  9. class queue
  10. {
  11.     int a[SIZE];
  12.     int front;
  13.     int rear;
  14. public:
  15.    
  16.  
  17.     queue();
  18.     ~queue();
  19.     queue operator+(queue &a);
  20.     queue operator=(queue &);
  21.     friend bool operator==(queue &a,queue &b){
  22.             if(a.rear==b.rear)
  23.             return true;
  24.         else return false;
  25. }
  26.     friend bool operator!=(queue &a,queue &b){
  27.                 if(a.rear==b.rear)
  28.             return false;
  29.         else return true;
  30. }
  31.     friend bool operator<(queue &a,queue &b){
  32.                 if(a.rear<b.rear)
  33.             return true;
  34.         else return false;
  35.     }
  36.     friend bool operator>(queue &a,queue &b){
  37.                 if(a.rear>b.rear)
  38.             return true;
  39.         else return false;
  40.     }
  41.     friend ostream& operator<<(ostream &out,  queue a){
  42.        
  43.         out<<a.a[front];
  44.         a.front++;
  45.        
  46.         return out;
  47.     }
  48.     friend istream& operator>>(istream &in, const queue &a){
  49.         a.rear++;
  50.         in>>a.a[rear];
  51.  
  52.         return in; 
  53.     }
  54.     void insert(int i);
  55.     int remove();
  56.     int isempty();
  57.     int isfull();
  58.     void printQ();
  59. };
Add Comment
Please, Sign In to add comment