Categories
- 4th semester (27)
- 5th semester (3)
- ADA (13)
- Assembly Level Language (12)
- BE (45)
- C Language Programming (5)
- C language (20)
- C++ Language (5)
- CCP Lab programing (3)
- Computer Programming Lab (3)
- DAA Lab Programming (13)
- Data Structure and C++ laboratory Program (6)
- Data Structure and C++ labotary Program (5)
- Design and Analysis of algorithm (14)
- First Year (5)
- MASM (12)
- Microprocessor (12)
- Microprocessor lab program (12)
- System Software & OS Laboratory (5)
- Unix program (4)
- bachelor of engineering (30)
- basic (1)
- basic mathematics (2)
- beginners (10)
- c++ program (9)
- calculations (7)
- computer science (30)
- downloadable (5)
- engineering syllabus (4)
- simple program (6)
Trend Posts
Blogger news
Author
Followers
Thursday, August 29, 2013
Design,develop and execute a program in C to stimulate the working of queue of integers using an array.Provide the following operations:
1.Insert 2.Delete 3.Display
CLICK HERE TO DOWNLOAD PROGRAM FILE
#include<stdio.h>
#include<conio.h>
#define MAX_SIZE 5
int front=-1,rear=-1,a,c,i,x,element;
int queue[MAX_SIZE];
void enqueue();
void dequeue();
void display();
void main()
{
clrscr();
while(1)
{
printf("\n++++MENU++++\n");
printf("============\n");
printf("1 for enqueue\n2 for dequeue\n3 for display");
printf("\n4 for exit\n");
printf("enter your choice:");
scanf("%d",&a);
switch(a)
{
case 1:
enqueue();
break;
case 2:
dequeue();
break;
case 3:
display();
break;
case 4:
exit(0);
break;
default:
printf("invalid..!");
break;
}
getch();
}
}
void enqueue()
{
if(rear==MAX_SIZE-1)
{
printf("queue full..!\n");
}
else
{
printf("enter a number:");
scanf("%d",&element);
rear++;
queue[rear]=element;
}
}
void dequeue()
{
if(front==rear)
{
printf("queue empty..!");
}
else
{
front++;
x=queue[front];
printf("deleted element is %d",x);
}
}
void display()
{
if(front==rear)
{
printf("queue empty..!");
}
else
printf("\nentered number:");
{
for(i=front+1;i<=rear;i++)
{
printf("%d",queue[i]);
}
}
}
______________________________//program ends
CLICK HERE TO DOWNLOAD PROGRAM FILE
screen shots:
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
You are very Important to Us...
STAY TUNE...