New Member FAQ
|
Forums
|
Earn Revenue
|
Distance Education
|
Help Topics
|
Admissions 2013
Login
Register
Articles
Practice Tests
Ask Experts
Question Papers
Jobs
Universities
Colleges
Courses
Schools
Gift Shop
|
Bookmarks
|
Reviews
|
Learn English
|
Social Hub
|
Training
|
New Posts
|
My India
|
Members
|
Polls
|
Active Members
Today
Jebaprincy
(272)
Chandresh
(270)
R Pramod
(189)
Last 7 Days
R Pramod
(1228)
K Mohan
(739)
Venkiteswaran.
(591)
more...
Resources
»
Articles/Knowledge Sharing
»
Computer & Technology
Write a Program To Perform INSERT & DELETE Operation on the “Queue”.
Posted Date:
07-Feb-2010
Category:
Computer & Technology
Author:
kamaldeep
Member Level:
Silver
Points
: 2
Write a Program To Perform INSERT & DELETE Operation on the “Queue”.
Write a Program To Perform INSERT & DELETE Operation on the “Queue”.
SOURCE CODE:
#include
#include
#include
int front=0,rear=0;
int i;
int QUEUE[5];
int item;
void main()
{
int opt;
int q=0;
clrscr();
printf("\nThis Program is Used to Perform INSERT & DELETE Operation on Queue");
printf("\n\n\tMain Menu.....");
printf("\n\n\t1.Insertion");
printf("\n\n\t2.Deletion");
printf("\n\n\t3.Displaying");
printf("\n\n\t4.Exit");
do
{
printf("\n\n\tEnter Your choice 1-4:");
scanf("%d",&opt);
switch(opt)
{
case 1:
printf("\n\tEnter the Element To be Inserted:");
scanf("%d",&item);
if(rear<5)
{
rear++;
QUEUE[rear]=item;
printf("\n\n\tElement Inserted");
if(front==0)
{
front=1;
rear=1;
}
}
else
{
printf("\nQueue Is Full,Insertion Not Possible");
}
break;
case 2:
if(front==0)
{
printf("\nQueue Is Empty,Deletion is Not Possible");
}
else
{
item=QUEUE[front];
printf("\n\tItem Deleted is %d ",item);
}
if(front==rear)
{
front=0;
rear=0;
}
else
front=front+1;
break;
case 3:
printf("\n\t\tQUEUE Is As:");
printf("\n\t");
for(i=front;i<=rear;i++)
{
printf("%3d",QUEUE[i]);
}
break;
case 4:
exit(1);
default:printf("\n\tWrong Choice,Enter Your Choice 1-4");
}
}while(q!=1);
getch();
}
OUTPUT
This program is used to perform INSERT AND DELETE operation on queque
Main menu.......
1. insertion
2.deletion
3.displaying
4.Exit
enter your choice 1-4:1
enter the element to be inserted:5
element inserted
enter your choice 1-4:1
enter the element to be inserted:7
Element Inserted
enter your choice 1-4:3
queue is as:
5 7
Enter your choice 1-4:2
item deleted is 5
Enter your choice 1-4:3
queque is as:
7
Enter your choice 1-4;_
Reference
Queue,data srtucture
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "Write a Program To Perform INSERT & DELETE Operation on the “Queue”."
No responses found. Be the first to respond...
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
Write a Program To Perform PUSH & POP Operations On Stack.
Previous Resource:
Write a Program To Sort the Elements Of an Array using “INSERTION SORT”.
Return to Resources
Post New Resource
Category:
Computer & Technology
Post resources and
earn money
!
More Resources
Write a Program To search an element using “Binary Search”.
Write a Program To sort the elements of an array using “Bubble Sort”.
Write a Program to Search An Element in 2-Dimensional Array Using Linear Search.
Write a Program to Search An Element in 1-Dimensional Array Using Linear Search.
Write a Program To Add,Subtract,Multipications and Traspose of Two Matrices using functions?
Requirements for a good Web Design
Popular Tags
Tag posting guidelines
Search Tags
1-Dimensional Array Using Linear Search
.
Data structure
.
Subscribe to Email
Get Jobs by Email
Forum posts by Email
Articles by Email
Awards & Gifts
Online Members
Chandresh
Pradip
Komal Sood
Ashok Goyal
Madhvee Chaubey
Jp
arunai
Kishori Mohon Dutta
Adesola Adeyeye
Arvind Kuril
Muneer.police
More...