HomeData Structures

Enqueue Function in Simple Queue

Enqueue Function in Simple Queue
Like Tweet Pin it Share Share Email

Enqueue function in simple Queue : Today We Know What is Enqueue Function in Simple Queue.

Enqueue function in simple Queue

void enqueue()
{ if(i<=4)
{ cout<<"Add number"<<endl;
cin>>num[i];
i++;}
else{cout<<endl<<"Error! Array is full.."<<endl;
}}

Dequeue function in simple Queue

void dequeue()
{
for(int j=0;j<i;j++)
num[j]=num[j+1]; i--; }

Display function in simple Queue

void show()
{ if(i==0)
cout<<"Array is Empty"<<endl;
else
{ for(int j=0;j<i;j++)
{ cout<<num[j]<<endl;
}}}

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *