| 29 | |
| 30 | }; |
| 31 | int main(){ |
| 32 | Queue q; |
| 33 | int ch; |
| 34 | int x; |
| 35 | cout<<"Press 0 to exit else enter 1: "; |
| 36 | cin>>ch; |
| 37 | while(ch!=0) |
| 38 | { |
| 39 | cout<<"\n"<<"1.ENQUEUE"<<"\n"<<"2.DEQUQUE"<<"\n"; |
| 40 | cout<<"\n"<<"Enter choice :"; |
| 41 | cin>>ch; |
| 42 | switch (ch) |
| 43 | { |
| 44 | case 1: |
| 45 | cout<<"Enter the value you want to enqueue: "; |
| 46 | cin>>x; |
| 47 | q.enqueue(x); |
| 48 | break; |
| 49 | case 2: |
| 50 | cout<<"Dequeued element is : "<<q.dequeue()<<"\n"; |
| 51 | break; |
| 52 | |
| 53 | default: |
| 54 | printf("\nINVALID CHOICE !!"); |
| 55 | break; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | |
| 60 | return 0; |
| 61 | } |