Programming Solutions. Learn C, C++ , Java , Data Structure , VHDl programming Language.
#include<conio.h> #include<iostream.h> #include<stdio.h> #define max 6 int q[10],rear=-1,front=-1; void insertInQ(int data) { if(rear==-1&&front==-1) { rear=0; front=0; q[rear]=data; return; } if(front==0&&rear==max-1||front==rear+1) { cout<<"overflow"; return; } if(rear==max-1) rear=0; else rear=rear+1; q[rear]=data; } int deleteFromQ(){ int data; if(front==-1&&rear==-1) { cout<<"underflow"; return 0; } data=q[front]; q[front]=NULL; if(front==rear) { front=rear=-1; } else { if(front==max-1) front=0; else front=front+1; } return data; } void printQ() { int i; for(i=0;i<max;i++) { if(q[i]==NULL) cout<<"t"; else cout<<"t"<<q[i]; } } int main() { int ch,d; while(1) { cout<<"n=========queue operations===========n 1.insert n 2.delete n 3.show n 4.exit n ========================= n Enter your choice : " ; cin>>ch; switch(ch) { case 1 : cout<<"n enter data :" ; cin>>d; insertInQ(d); break; case 2: d=deleteFromQ(); cout<<"n data is :"<<d; break; case 3: printQ(); break; case 4: exit(0); default : cout<<"n wrong choice------ n"; break; } } getch(); return 0; } |
1xbet korean | Legalbet.co.kr
ReplyDelete1xbet korean. You can also 1xbet вход use the option of depositing funds in Betway, the popular casino and poker online games.