100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Queue Operation

Rating
-
Sold
-
Pages
2
Uploaded on
14-01-2021
Written in
2020/2021

C++ code for Queue operation well defined and well commented.

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
January 14, 2021
Number of pages
2
Written in
2020/2021
Type
Class notes
Professor(s)
Inayat ur rehman
Contains
All classes

Subjects

Content preview

void Que :: enqueue()
{
if(isEmpty())
{
frontIndex = rearIndex = 0;
cout<<"Initially the queue is empty!"<<endl;
cout<<"Inserting the first element..."<<endl;
cout<<"Enter a number: ";
cin>>queue[frontIndex];
cout<<endl;
}
else if(isFull())
{
cout<<"OOPS! No Space is Available!"<<endl;
}
else
{
if(frontIndex != 0 && rearIndex == (SIZE - 1))
{
rearIndex = 0;
cout<<"Enter a number: ";
cin>>queue[rearIndex];
cout<<endl;
}
else
{
rearIndex++;
if(rearIndex == frontIndex)
{
cout<<"OOPS! Queue is full!"<<endl;
}
else
{
cout<<"Enter a number: ";
cin>>queue[rearIndex];
cout<<endl;
}
}
}
}

int Que :: dequeue()
{
if(isEmpty())
{
cout<<"Queue is empty!"<<endl;
}

else if(rearIndex == (SIZE - 1))
{
if(frontIndex == rearIndex)
{
$7.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
youtubecanvas

Get to know the seller

Seller avatar
youtubecanvas COMSATS Institute Of Information Technology
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
4 year
Number of followers
0
Documents
18
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions