@imane,
this is using c
#include<stdio.h>
#include<conio.h>
#include<process.h>
int in_top=-1;
int out_top=-1;
void in_stack_push(int item);
int in_stack_pop();
void out_stack_push();
int out_stack_pop();
int insert_queue[20],delete_queue[20];
void main()
{
int i,ch,item;
clrscr();
while(1)
{
printf("\n1. Insert");
printf("\n2. Delete");
printf("\nEnter Your Choice:- ");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\n\nEnter the Element in Queue:- ");
scanf("%d",&item);
in_stack_push(item);
break;
case 2:
printf("Element Deleted:-%d",out_stack_pop());
break;
default:
printf("Thank You For using queue using two stack");
getche();
exit(0);
}
}
}
void in_stack_push(int item)
{
if(in_top>20)
printf("Queue Full");
else
insert_queue[++in_top]=item;
}
int in_stack_pop()
{
if(in_top>=0)
return insert_queue[in_top--];
}
void out_stack_push()
{
if(in_top==-1)
{
printf("Queue Empty");
}
else
{
while(in_top>=0)
delete_queue[++out_top]=in_stack_pop();
}
}
int out_stack_pop()
{
if(out_top==-1)
{
out_stack_push();
}
if(out_top<0 && in_top<0)
return 0;
if(out_top>=0)
return delete_queue[out_top--];
}